enl / flysystem-cloudinary

Cloudinary adapter for Flysystem
MIT License
27 stars 20 forks source link

Enl\Flysystem\Cloudinary

Build Status Software License Coverage Status

This is a Flysystem adapter for Cloudinary API.

Installation

composer require enl/flysystem-cloudinary '~1.0'

Or just add the following string to require part of your composer.json:

{
    "require": {
        "enl/flysystem-cloudinary": "~1.0"
    }
}

Bootstrap

<?php
use Enl\Flysystem\Cloudinary\ApiFacade as CloudinaryClient;
use Enl\Flysystem\Cloudinary\CloudinaryAdapter;
use League\Flysystem\Filesystem;

include __DIR__ . '/vendor/autoload.php';

$client = new CloudinaryClient([
    'cloud_name' => 'your-cloudname-here',
    'api_key' => 'api-key',
    'api_secret' => 'You-know-what-to-do',
    'overwrite' => true, // set this to true if you want to overwrite existing files using $filesystem->write();
]);

$adapter = new CloudinaryAdapter($client);
// This option disables assert that file is absent before calling `write`.
// It is necessary if you want to overwrite files on `write` as Cloudinary does it by default.
$filesystem = new Filesystem($adapter, ['disable_asserts' => true]);

Cloudinary features

Please, keep in mind three possible pain-in-asses of Cloudinary:

Good news!

The library supports Cloudinary Transformations!