speicher210 / cloudinary-bundle
Bundle for Cloudinary PHP API library
Installs: 147 247
Dependents: 1
Suggesters: 1
Security: 0
Stars: 23
Watchers: 6
Forks: 10
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^7.4 || ^8.0
- cloudinary/cloudinary_php: ^1.20.2
- symfony/console: ^4.4 || ^5.4 || ^6.0
- symfony/finder: ^4.4 || ^5.4 || ^6.0
- symfony/framework-bundle: ^4.4 || ^5.4 || ^6.0
- symfony/yaml: ^4.4 || ^5.4 || ^6.0
Requires (Dev)
- doctrine/coding-standard: ^12.0
- ergebnis/composer-normalize: ^2.28.3
- roave/security-advisories: dev-latest
- symfony/phpunit-bridge: ^6.0
- twig/twig: ^1.44 || ^2.0 || ^3.0
Suggests
- twig/twig: Allow to use the cloudinary_url function/filter
README
Install
Add speicher210/cloudinary-bundle
to your composer.json
file:
composer require "speicher210/cloudinary-bundle"
Register the bundle:
<?php // config/bundles.php return [ // ... Speicher210\CloudinaryBundle\Speicher210CloudinaryBundle::class => ['all' => true], // ... ];
or
// app/AppKernel.php // ... public function registerBundles() { return array( // ... new Speicher210\CloudinaryBundle\Speicher210CloudinaryBundle(), // ... ); } // ...
Usage
Configure the connection to cloudinary in your config.yml
:
speicher210_cloudinary: url: cloudinary://my-key:my-secret@my-cloud # The next configuration variables should be defined if they are not present in the URL # The URL will take precedence cloud_name: my-cloud access_identifier: api_key: my-key api_secret: my-secret options: secure: true
The following services will be available:
$this->get('speicher210_cloudinary.cloudinary'); // Extension of Cloudinary from cloudinary package. $this->get('speicher210_cloudinary.api'); // Extension of Cloudinary\Api from cloudinary package. $this->get('speicher210_cloudinary.uploader'); // Extension of Cloudinary\Uploader from cloudinary package.
You can pass the same options to the twig filter or function:
{{ cloudinary-public-id | cloudinary_url({'width': 50, 'height': 50, 'crop': 'fill'}) }} {{ cloudinary_url('cloudinary-public-id', {'width': 50, 'height': 50, 'crop': 'fill'}) }} {{ cloudinary_image_tag('cloudinary-public-id', {'height' : 150}) }} {{ cloudinary_video_tag('cloudinary-public-id', {'height' : 150}) }}
For further documentation see Cloudinary PHP library
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.