shanmuga/laravel-cloudinary
Composer 安装命令:
composer require shanmuga/laravel-cloudinary
包简介
Cloudinary Wrapper for Laravel 5,6 and 7
README 文档
README
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
This Package is the fork of unmaintained package https://github.com/jrm2k6/cloudder
Installation
You can install the package via composer:
composer require shanmuga/laravel-cloudinary
Configuration
Modify your .env file to add the following information from Cloudinary
Required
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret_key
CLOUDINARY_CLOUD_NAME=your_cloud_name
Optional
CLOUDINARY_BASE_URL
CLOUDINARY_SECURE_URL
CLOUDINARY_API_BASE_URL
Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider. If you don't use auto-discovery follow the next steps:
Add the following in config/app.php:
'providers' => array( Shanmuga\LaravelCloudinary\CloudinaryServiceProvider::class, ); 'aliases' => array( 'LaravelCloudinary' => Shanmuga\LaravelCloudinary\Facades\CloudinaryFacade::class, );
Run php artisan vendor:publish --tag="LaravelCloudinary"
Usage
upload()
LaravelCloudinary::upload($filename, $publicId, array $options, array $tags);
with:
$filename: path to the image you want to upload$publicId: the id you want your picture to have on Cloudinary, leave it null to have Cloudinary generate a random id.$options: options for your uploaded image, check the Cloudinary documentation to know more$tags: tags for your image
returns the CloudinaryWrapper.
uploadVideo()
LaravelCloudinary::uploadVideo($filename, $publicId, array $options, array $tags);
with:
$filename: path to the video you want to upload$publicId: the id you want your video to have on Cloudinary, leave it null to have Cloudinary generate a random id.$options: options for your uploaded video, check the Cloudinary documentation to know more$tags: tags for your image
returns the CloudinaryWrapper.
getPublicId()
LaravelCloudinary::getPublicId()
returns the public id of the last uploaded resource.
getResult()
LaravelCloudinary::getResult()
returns the result of the last uploaded resource.
show() + secureShow()
LaravelCloudinary::show($publicId, array $options) LaravelCloudinary::secureShow($publicId, array $options)
with:
$publicId: public id of the resource to display$options: options for your uploaded resource, check the Cloudinary documentation to know more
returns the url of the picture on Cloudinary (https url if secureShow is used).
showPrivateUrl()
LaravelCloudinary::showPrivateUrl($publicId, $format, array $options)
with:
$publicId: public id of the resource to display$format: format of the resource your want to display ('png', 'jpg'...)$options: options for your uploaded resource, check the Cloudinary documentation to know more
returns the private url of the picture on Cloudinary, expiring by default after an hour.
rename()
LaravelCloudinary::rename($publicId, $toPublicId, array $options)
with:
$publicId: publicId of the resource to rename$toPublicId: new public id of the resource$options: options for your uploaded resource, check the cloudinary documentation to know more
renames the original picture with the $toPublicId id parameter.
destroyImage() + delete()
LaravelCloudinary::destroyImage($publicId, array $options) LaravelCloudinary::delete($publicId, array $options)
with:
$publicId: publicId of the resource to remove$options: options for the image to delete, check the cloudinary documentation to know more
removes image from Cloudinary.
destroyImages()
LaravelCloudinary::destroyImages(array $publicIds, array $options)
with:
$publicIds: array of ids, identifying the pictures to remove$options: options for the images to delete, check the cloudinary documentation to know more
removes images from Cloudinary.
addTag()
LaravelCloudinary::addTag($tag, $publicIds, array $options)
with:
$tag: tag to apply$publicIds: images to apply tag to$options: options for your uploaded resource, check the cloudinary documentation to know more
removeTag()
LaravelCloudinary::removeTag($tag, $publicIds, array $options)
with:
$tag: tag to remove$publicIds: images to remove tag from$options: options for your uploaded image, check the Cloudinary documentation to know more
createArchive()
LaravelCloudinary::createArchive(array $options, $archiveName, $mode)
with:
$options: options for your archive, like name, tag/prefix/public ids to select images$archiveName: name you want to give to your archive$mode: 'create' or 'download' ('create' will create an archive and returns a JSON response with the properties of the archive, 'download' will return the zip file for download)
creates a zip file on Cloudinary.
downloadArchiveUrl()
LaravelCloudinary::downloadArchiveUrl(array $options, $archiveName)
with:
$options: options for your archive, like name, tag/prefix/public ids to select images$archiveName: name you want to give to your archive
returns a download url for the newly created archive on Cloudinary.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email shanmugarajan.33@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
shanmuga/laravel-cloudinary 适用场景与选型建议
shanmuga/laravel-cloudinary 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 937 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「laravel」 「cloudinary」 「laravel-cloudinary」 「shanmuga」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shanmuga/laravel-cloudinary 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shanmuga/laravel-cloudinary 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shanmuga/laravel-cloudinary 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Cloudinary Flysystem 3 integration with Laravel
A stylish PHP application framework crafted using Slim, Twig, Eloquent and Sentinel designed to get you from clone to production in a matter of minutes.
Flysystem adapter for Cloudinary
Alfabank REST API integration
Cloudinary Cake PHP SDK
Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.
统计信息
- 总下载量: 937
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-08