Skip to content

Repository files navigation

Flysystem Adapter for Cloudinary API

Latest Version on Packagist Total Downloads GitHub Actions

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.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages