Download the PHP package codebar-ag/laravel-flysystem-cloudinary without Composer
On this page you can find all versions of the php package codebar-ag/laravel-flysystem-cloudinary. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codebar-ag/laravel-flysystem-cloudinary
More information about codebar-ag/laravel-flysystem-cloudinary
Files in codebar-ag/laravel-flysystem-cloudinary
Package laravel-flysystem-cloudinary
Short Description Cloudinary Flysystem v1 integration with Laravel
License MIT
Homepage https://github.com/codebar-ag/laravel-flysystem-cloudinary
Informations about the package laravel-flysystem-cloudinary
💡 What is Cloudinary?
Cloudinary is basically a fantastic way to store and serve assets like images or videos. You can upload your full resolution image to Cloudinary, and they handle the optimization for you. The only thing you have to do is to add additional parameters to your url 😉
🛠 Requirements
- Cloudinary Account
Package | PHP | Laravel | Flysystem |
---|---|---|---|
>v4.0 | >8.3 | > Laravel 11 | > 3.0 |
>v3.0 | >8.2 | > Laravel 10 | > 3.0 |
>v2.0 | >8.1 | > Laravel 9 | > 3.0 |
>v1.0 | >8.0 | > Laravel 8 | > 1.1 |
⚙️ Installation
You can install the package via composer:
Add the following disk to your filesystem "disks" list in your filesystems.php
configuration:
Add the following environment variables to your .env
file:
🏗 File extension problem
Let's look at the following example:
This will generate following URL with double extensions:
To prevent this you should store your images without the file extension:
This is now much better:
🪐 How to use with Nova
We have a package for use with Laravel Nova: Laravel Flysystem Cloudinary Nova
🗂 How to use folder prefix
Imagine the following example. We have different clients but want to store the assets in the same Cloudinary account. Normally we have to prefix every path with the correct client folder name. Fortunately, the package helps us here. We can configure a folder in our environment file like this:
Now all our assets will be prefixed with the client_cat/
folder. When we
store following image:
It will produce following URL:
In the Media Library it is stored in client_cat/meow
and you can retrieve
the image with meow
:
This should increase the trust to store and retrieve your assets from the correct folder.
🔋 Rate limit gotchas
All files in Cloudinary are stored with a resource type. There are three kinds
of it: image
, raw
and video
. For example if we want to check if a video
exists, we need to make up to 3 requests. Every type needs to be checked on
their own with a separate request.
Keep this in mind because the admin API is rate limited to 500 calls per hour.
The package does check in following sequence:
image
➡️raw
➡️video
⚙️ Optional Parameters
Cloudinary has a lot of optional parameters to customize the upload. You can find all options in the official documentation optional parameters section.
You can pass all parameters as an array to the put
method:
Note: if you find yourself using the same parameters for all requests, you should consider adding them to the config file. (see below)
🔧 Configuration file
You can publish the config file with:
This is the contents of the published config file:
🚧 Testing
Run the tests:
📝 Changelog
Please see CHANGELOG for more information on what has changed recently.
✏️ Contributing
Please see CONTRIBUTING for details.
🧑💻 Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
🙏 Credits
- Ruslan Steiger
- Sebastian Fix
- All Contributors
- Skeleton Repository from Spatie
- Laravel Package Training from Spatie
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-flysystem-cloudinary with dependencies
guzzlehttp/guzzle Version ^7.8
illuminate/contracts Version ^11.0
spatie/laravel-package-tools Version ^1.16
cloudinary/cloudinary_php Version ^2.13
nesbot/carbon Version ^2.72