cloudinary-labs/cloudinary-laravel
Composer 安装命令:
composer require cloudinary-labs/cloudinary-laravel
包简介
A Laravel Cloudinary Package
README 文档
README
A Laravel Package for uploading, optimizing, transforming and delivering media files with Cloudinary. Furthermore, it provides a fluent and expressive API to easily attach your media files to Eloquent models.
Table of Contents
Installation
Requires PHP 8.2+ and Laravel 11+.
composer require cloudinary-labs/cloudinary-laravel
After you have installed the SDK, you can invoke the install command to set everything up:
php artisan cloudinary:install
Add your Cloudinary credentials to your .env file:
CLOUDINARY_URL=cloudinary://API_KEY:API_SECRET@CLOUD_NAME
CLOUDINARY_UPLOAD_PRESET=your_upload_preset
CLOUDINARY_NOTIFICATION_URL=
Note
You can get your CLOUDINARY_URL from your Cloudinary console. It typically looks like this: cloudinary://API_KEY:API_SECRET@CLOUD_NAME. Make sure to replace API_KEY, API_SECRET, and CLOUD_NAME with your actual Cloudinary credentials.
Usage
File Storage Driver
This SDK implements the File Storage Driver interface allowing you to use it as just another storage destination like s3, azure or local disk.
Add a new cloudinary key to your config/filesystems.php disk key like so:
..., 'cloudinary' => [ 'driver' => 'cloudinary', 'key' => env('CLOUDINARY_KEY'), 'secret' => env('CLOUDINARY_SECRET'), 'cloud' => env('CLOUDINARY_CLOUD_NAME'), 'url' => env('CLOUDINARY_URL'), 'secure' => (bool) env('CLOUDINARY_SECURE', true), 'prefix' => env('CLOUDINARY_PREFIX'), ], ...,
Blade Components
This package provides a few Blade components for easy integration of Cloudinary media in your Laravel views.
Upload Widget
You can use the <x-cloudinary::widget /> Blade component that ships with this like so:
<!DOCTYPE html> <html> <body> <x-cloudinary::widget>Upload Files</x-cloudinary::widget> </body> </html>
Image Component
Basic usage:
<x-cloudinary::image public-id="example" />
With additional properties:
<x-cloudinary::image public-id="example" width="300" height="300" />
Properties available:
| Property | Required |
|---|---|
public-id |
Yes |
width |
No |
height |
No |
alt |
No |
class |
No |
crop |
No |
gravity |
No |
effect |
No |
rotate |
No |
colorize |
No |
trim |
No |
blur |
No |
gray-scale |
No |
black-white |
No |
sepia |
No |
redeye |
No |
negate |
No |
oil-paint |
No |
vignette |
No |
simulate-colorblind |
No |
pixelate |
No |
unsharp-mask |
No |
saturation |
No |
contrast |
No |
brightness |
No |
gamma |
No |
improve-mode |
No |
shadow |
No |
border |
No |
round-corners |
No |
bg-color |
No |
art |
No |
cartoonify |
No |
Video Component
Basic usage:
<x-cloudinary::video public-id="example" />
With additional properties:
<x-cloudinary::video public-id="example" width="300" height="300" />
Properties available:
| Property | Required |
|---|---|
public-id |
Yes |
width |
No |
height |
No |
Disclaimer
This software/code provided under Cloudinary Labs is an unsupported pre-production prototype undergoing further development and provided on an “AS IS” basis without warranty of any kind, express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. Furthermore, Cloudinary is not under any obligation to provide a commercial version of the software.
Your use of the Software/code is at your sole risk and Cloudinary will not be liable for any direct, indirect, incidental, special, exemplary, consequential or similar damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of the Software, even if advised of the possibility of such damage.
You should refrain from uploading any confidential or personally identifiable information to the Software. All rights to and in the Software are and will remain at all times, owned by, or licensed to Cloudinary.
Contributions
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
This package is open-sourced software licensed under the MIT license.
cloudinary-labs/cloudinary-laravel 适用场景与选型建议
cloudinary-labs/cloudinary-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.4M 次下载、GitHub Stars 达 331, 最近一次更新时间为 2020 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Media management」 「file uploads」 「laravel」 「cloudinary」 「cloudinary-laravel」 「File Transformations」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cloudinary-labs/cloudinary-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cloudinary-labs/cloudinary-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cloudinary-labs/cloudinary-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
Laravel Media Popup to upload/view the files
A Silverstripe module to allow you to log into any of your Silverstripe sites from one place.
PMVC Plugin for File information
Task system for APPUI
统计信息
- 总下载量: 1.4M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 332
- 点击次数: 32
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-15