Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jrm2k6/cloudder
Cloudinary wrapper for Laravel 5
https://github.com/jrm2k6/cloudder
cloudinary image laravel-4-package laravel-5-package lumen
Last synced: about 2 months ago
JSON representation
Cloudinary wrapper for Laravel 5
- Host: GitHub
- URL: https://github.com/jrm2k6/cloudder
- Owner: jrm2k6
- License: mit
- Archived: true
- Created: 2015-04-06T15:42:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-04T04:54:40.000Z (almost 4 years ago)
- Last Synced: 2024-09-21T14:06:23.816Z (about 2 months ago)
- Topics: cloudinary, image, laravel-4-package, laravel-5-package, lumen
- Language: PHP
- Homepage:
- Size: 58.6 KB
- Stars: 264
- Watchers: 9
- Forks: 56
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudder - Cloudinary wrapper for Laravel 5 / Lumen
#### This project is not actively maintained. I might be slow to answer, as you can tell by looking at the issues. I have moved to some new projects, not in the PHP ecosystem. You can always reach out to me through my email.
#### If you fork it on publish it as your own, it might be nice to credit the original author at https://github.com/teepluss/laravel4-cloudinary.
[![Build Status](http://img.shields.io/travis/jrm2k6/cloudder/master.svg?style=flat-square)](https://travis-ci.org/jrm2k6/cloudder)
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://www.opensource.org/licenses/MIT)
[![Latest Version](http://img.shields.io/packagist/v/jrm2k6/cloudder.svg?style=flat-square)](https://packagist.org/packages/jrm2k6/cloudder)
[![Total Downloads](https://img.shields.io/packagist/dt/jrm2k6/cloudder.svg?style=flat-square)](https://packagist.org/packages/jrm2k6/cloudder)> Initially forked from https://github.com/teepluss/laravel4-cloudinary.
> **If there is any feature you would like feel free to open an issue or send me an email!**
## Installation
`composer require jrm2k6/cloudder`
For people still using Laravel 4.2: `composer require jrm2k6/cloudder:0.1.*` and check the branch l4 for the installation instructions.
## Configuration
Modify your `.env` file to add the following information from [Cloudinary](http://www.cloudinary.com)
### Required
```
CLOUDINARY_API_KEY=012345679890123
CLOUDINARY_API_SECRET=foobarfoobarfoob-arfoobarfo
CLOUDINARY_CLOUD_NAME=foobarcorp
```### 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:
```php
'providers' => array(
JD\Cloudder\CloudderServiceProvider::class,
);'aliases' => array(
'Cloudder' => JD\Cloudder\Facades\Cloudder::class,
);
```Run `php artisan vendor:publish --provider="JD\Cloudder\CloudderServiceProvider"`
## Usage
### upload()
```php
Cloudder::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](http://cloudinary.com/documentation/php_image_upload#all_upload_options) to know more
* `$tags`: tags for your imagereturns the `CloudinaryWrapper`.
### uploadVideo()
```php
Cloudder::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 imagereturns the `CloudinaryWrapper`.
### getPublicId()
```php
Cloudder::getPublicId()
```returns the `public id` of the last uploaded resource.
### getResult()
```php
Cloudder::getResult()
```returns the result of the last uploaded resource.
### show() + secureShow()
```php
Cloudder::show($publicId, array $options)
Cloudder::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 morereturns the `url` of the picture on Cloudinary (https url if secureShow is used).
### showPrivateUrl()
```php
Cloudder::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 morereturns the `private url` of the picture on Cloudinary, expiring by default after an hour.
### rename()
```php
Cloudder::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 morerenames the original picture with the `$toPublicId` id parameter.
### destroyImage() + delete()
```php
Cloudder::destroyImage($publicId, array $options)
Cloudder::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 moreremoves image from Cloudinary.
### destroyImages()
```php
Cloudder::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 moreremoves images from Cloudinary.
### addTag()
```php
Cloudder::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()
```php
Cloudder::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()
```php
Cloudder::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()
```php
Cloudder::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 archivereturns a `download url` for the newly created archive on Cloudinary.
## Running tests
`phpunit`
## Example
You can find a working example in the repo [cloudder-l5-example](https://github.com/jrm2k6/cloudder-l5-sample-project)