speicher210 / cloudinary-bundle
Cloudinary PHP API 库的扩展包
0.13.0
2023-04-26 16:45 UTC
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
安装
将 speicher210/cloudinary-bundle
添加到您的 composer.json
文件中
composer require "speicher210/cloudinary-bundle"
注册扩展包
<?php // config/bundles.php return [ // ... Speicher210\CloudinaryBundle\Speicher210CloudinaryBundle::class => ['all' => true], // ... ];
或者
// app/AppKernel.php // ... public function registerBundles() { return array( // ... new Speicher210\CloudinaryBundle\Speicher210CloudinaryBundle(), // ... ); } // ...
用法
在您的 config.yml
中配置对 cloudinary 的连接
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
以下服务将可用
$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.
您可以将相同的选项传递给 twig 过滤器或函数
{{ 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}) }}
有关更多信息,请参阅 Cloudinary PHP 库
贡献
有关详细信息,请参阅 CONTRIBUTING
安全
如果您发现任何安全相关的问题,请通过电子邮件报告,而不是使用问题跟踪器。
鸣谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件