Download the PHP package wearemodus/flysystem-cloudinary without Composer
On this page you can find all versions of the php package wearemodus/flysystem-cloudinary. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wearemodus/flysystem-cloudinary
More information about wearemodus/flysystem-cloudinary
Files in wearemodus/flysystem-cloudinary
Package flysystem-cloudinary
Short Description Cloudinary adapter for Flysystem.
License MIT
Informations about the package flysystem-cloudinary
WeAreModus\Flysystem\Cloudinary
This is a Flysystem adapter for Cloudinary API.
Installation
Or just add the following string to require
part of your composer.json
:
Bootstrap
Cloudinary features
Please, keep in mind three possible pain-in-asses of Cloudinary:
- It adds automatically file extension to its public_id. In terms of Flysystem, cloudinary's public_id is considered as filename. However, if you set public_id as 'test.jpg' Cloudinary will save the file as 'test.jpg.jpg'. In order to work it around, you can use PathConverterInterface.
- It does not support folders creation through the API
- If you want to save your files using folder you should set public_ids like 'test/test.jpg' and allow automated folder creation in your account settings in Cloudinary dashboard.
Good news!
The library supports Cloudinary Transformations!
WeAreModus Fork
This fork includes some essential changes needed for my use-case. See CHANGELOG.md for a full list of changes, but here are the cliff notes:
- Upload settings default to resource_type 'auto' in order to support video upload in addition to images
- DataUri now reads the mime-type of media using only the first 1 MB, in order to prevent memory overflow for large files due to
finfo->buffer()
- ApiFacade constructor now accepts an uploadOptions argument containing options that are passed through to the Cloudinary SDK's upload function
- Added explicit PHP types (this will prevent compatibility with PHP
<7.4
) - Updated dependencies _(PHP >=7.4, PHPUnit ^9, cloudinary_php ^2, phpcodesniffer 3.*)
Using with Laravel-MediaLibrary
In order to integrate this Cloudinary filesystem with Laravel-MediaLibrary, you will need to create a new filesystem driver as outline below:
- Define your Cloudinary
.env
variablesCLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
-
Define a new filesystem driver in your
filesystems.php
config file (within the 'disks' array) -
Create a new CloudinaryServiceProvider
php artisan make:provider CloudinarySeviceProvider
, and insert this code into theboot()
method - Finally, simply define
'cloudinary'
as your diskName when managing media
All versions of flysystem-cloudinary with dependencies
ext-fileinfo Version *
league/flysystem Version ^1.1
cloudinary/cloudinary_php Version ^2