jasirilabs / flysystem-cloudinary
Flysystem Adapter for the Cloudinary v2 API
Requires
- php: ^7.4|^8.0
- cloudinary/cloudinary_php: ^2.6
- league/flysystem: ^3.0
Requires (Dev)
- league/flysystem-adapter-test-utilities: ^3.0
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.0
README
Flysystem Adapter for Cloudinary API
The package contains a flysystem adapter for cloudinary. Under the hood Cloudinary PHP SDKis used.
Disclaimer
This package is still under active development but fill free to try out leave a PR or file an issue incase of any challenge
Installation
You can install the package via composer:
composer require jasirilabs/flysystem-cloudinary
Usage
Then follow the steps on using custom filesystem with laravel.
Quick Start
FILESYSTEM_DISK= CLOUDINARY_NAME= CLOUDINARY_KEY= CLOUDINARY_SECRET=
Add cloudinary disk in filesystem.php
... 'disk' => [ ... 'cloudinary' => [ 'driver' => 'cloudinary', 'name' => env('CLOUDINARY_NAME'), 'key' => env('CLOUDINARY_KEY'), 'secret' => env('CLOUDINARY_SECRET'), ]
Add the following on boot method of AppServiceProvider.php
file
Storage::extend('cloudinary', function ($app, $config) { $configuration = new Configuration(); $configuration->cloud->cloudName = $config['name']; $configuration->cloud->apiKey = $config['key']; $configuration->cloud->apiSecret = $config['secret']; $configuration->url->secure = true; $cloudinary = new Cloudinary($configuration); $adapter = new CloudinaryAdapter($cloudinary); return new FilesystemAdapter( new Filesystem($adapter, $config), $adapter, $config ); });
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email hello@brunoalfred.me instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
PHP Package Boilerplate
This package was generated using the PHP Package Boilerplate by Beyond Code.