在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):GrahamCampbell/Laravel-GitHub开源软件地址(OpenSource Url):https://github.com/GrahamCampbell/Laravel-GitHub开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):Laravel GitHubLaravel GitHub was created by, and is maintained by Graham Campbell, and is a PHP GitHub API bridge for Laravel. It utilises my Laravel Manager package. Feel free to check out the change log, releases, security policy, license, code of conduct, and contribution guidelines. InstallationThis version requires PHP 7.4-8.1 and supports Laravel 8-9.
To get the latest version, simply require the project using Composer: $ composer require "graham-campbell/github:^11.0" Once installed, if you are not using automatic package discovery, then you need to register the You can also optionally alias our facade: 'GitHub' => GrahamCampbell\GitHub\Facades\GitHub::class, ConfigurationLaravel GitHub requires connection configuration. To get started, you'll need to publish all vendor assets: $ php artisan vendor:publish This will create a There are two config options: Default Connection NameThis option ( GitHub ConnectionsThis option ( HTTP CacheThis option ( UsageGitHubManagerThis is the class of most interest. It is bound to the ioc container as Facades\GitHubThis facade will dynamically pass static method calls to the GitHubServiceProviderThis class contains no public methods of interest. This class should be added to the providers array in Real ExamplesHere you can see an example of just how simple this package is to use. Out of the box, the default adapter is use GrahamCampbell\GitHub\Facades\GitHub;
// you can alias this in config/app.php if you like
GitHub::me()->organizations();
// we're done here - how easy was that, it just works!
GitHub::repo()->show('GrahamCampbell', 'Laravel-GitHub');
// this example is simple, and there are far more methods available The github manager will behave like it is a use GrahamCampbell\GitHub\Facades\GitHub;
// the alternative connection is the other example provided in the default config
GitHub::connection('alternative')->me()->emails()->add('[email protected]');
// now we can see the new email address in the list of all the user's emails
GitHub::connection('alternative')->me()->emails()->all(); With that in mind, note that: use GrahamCampbell\GitHub\Facades\GitHub;
// writing this:
GitHub::connection('main')->issues()->show('GrahamCampbell', 'Laravel-GitHub', 2);
// is identical to writing this:
GitHub::issues()->show('GrahamCampbell', 'Laravel-GitHub', 2);
// and is also identical to writing this:
GitHub::connection()->issues()->show('GrahamCampbell', 'Laravel-GitHub', 2);
// this is because the main connection is configured to be the default
GitHub::getDefaultConnection(); // this will return main
// we can change the default connection
GitHub::setDefaultConnection('alternative'); // the default is now alternative If you prefer to use dependency injection over facades like me, then you can easily inject the manager like so: use GrahamCampbell\GitHub\GitHubManager;
use Illuminate\Support\Facades\App; // you probably have this aliased already
class Foo
{
protected $github;
public function __construct(GitHubManager $github)
{
$this->github = $github;
}
public function bar()
{
$this->github->issues()->show('GrahamCampbell', 'Laravel-GitHub', 2);
}
}
App::make('Foo')->bar(); For more information on how to use the Further InformationThere are other classes in this package that are not documented here. This is because they are not intended for public use and are used internally by this package. SecurityIf you discover a security vulnerability within this package, please send an email to [email protected]. All security vulnerabilities will be promptly addressed. You may view our full security policy here. LicenseLaravel GitHub is licensed under The MIT License (MIT). For EnterpriseAvailable as part of the Tidelift Subscription The maintainers of |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论