speicher210/cloudinary-bundle

Cloudinary PHP API 库的扩展包

安装数: 146,360

依赖项: 1

建议者: 1

安全: 0

星标: 23

关注者: 6

分支: 10

开放问题: 1

类型:symfony-bundle

0.13.0 2023-04-26 16:45 UTC

This package is auto-updated.

Last update: 2024-08-30 01:25:59 UTC


README

Latest Version Software License GitHub branch checks state

安装

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)。有关更多信息,请参阅 许可证文件