在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):GrahamCampbell/Laravel-Flysystem开源软件地址(OpenSource Url):https://github.com/GrahamCampbell/Laravel-Flysystem开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):Laravel FlysystemLaravel Flysystem was created by, and is maintained by Graham Campbell, and is a Flysystem 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.
To get the latest version, simply require the project using Composer: $ composer require "graham-campbell/flysystem:^8.0" There are also some additional dependencies you will need to install for some of the features:
Once installed, if you are not using automatic package discovery, then you need to register the You can also optionally alias our facade: 'Flysystem' => GrahamCampbell\Flysystem\Facades\Flysystem::class, ConfigurationLaravel Flysystem requires connection configuration. To get started, you'll need to publish all vendor assets: $ php artisan vendor:publish This will create a There are three config options: Default Connection NameThis option ( Flysystem ConnectionsThis option ( Flysystem CacheThis option ( UsageFlysystemManagerThis is the class of most interest. It is bound to the ioc container as Facades\FlysystemThis facade will dynamically pass static method calls to the FlysystemServiceProviderThis 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\Flysystem\Facades\Flysystem;
// you can alias this in config/app.php if you like
Flysystem::put('hi.txt', 'foo');
// we're done here - how easy was that, it just works!
Flysystem::read('hi.txt'); // this will return foo The flysystem manager will behave like it is a use GrahamCampbell\Flysystem\Facades\Flysystem;
// note the foo connection does not ship with this package, it's hypothetical
Flysystem::connection('foo')->put('test.txt', 'bar');
// now we can read that file
Flysystem::connection('foo')->read('test.txt'); // this will return bar With that in mind, note that: use GrahamCampbell\Flysystem\Facades\Flysystem;
// writing this:
Flysystem::connection('local')->read('test.txt');
// is identical to writing this:
Flysystem::read('test.txt');
// and is also identical to writing this:
Flysystem::connection()->read('test.txt');
// this is because the local connection is configured to be the default
Flysystem::getDefaultConnection(); // this will return local
// we can change the default connection
Flysystem::setDefaultConnection('foo'); // the default is now foo If you prefer to use dependency injection over facades like me, then you can easily inject the manager like so: use GrahamCampbell\Flysystem\FlysystemManager;
use Illuminate\Support\Facades\App; // you probably have this aliased already
class Foo
{
protected $flysystem;
public function __construct(FlysystemManager $flysystem)
{
$this->flysystem = $flysystem;
}
public function bar()
{
$this->flysystem->read('test.txt');
}
}
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 Flysystem 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
请发表评论