cakephp php
Chidiebere Chukwudi  

Cloudinary Media Mgt package/plugin for cakephp

Hi there, one time  I was developing a fullstack application  in cakephp framework and needed to use cloudinary for uploading media files hence, I searched for a cakephp package/ plugin to help me do that but could only find laravel package for that purpose and no updated version for that of cakephp.

So yeah, I released a cakephp cloudinary media management plugin for that. It is a wrapper around the cloudinary php sdk. Inspired by laravel cloudinary package. Please give it a star on GitHub. Contributions are welcome!

 

Compatible with cakephp 4+, Here: cakephp cloudinary plugin

Install:

composer require jovialcore/cake-cloudinary

Add your cloudinary credentials in config/app_local.php

    // ...
    'Cloudinary' => [
        'default' => [
            'cloud_name' => 'your_cloud_name',
            'api_key' => 'your_api_key',
            'api_secret' => 'your_api_secret',
            'secure' => true // use HTTPS
        ],
    ],
    // ...
];

To use the Cloudinary component in your controller, you need to load it in your initialize method:

// src/Controller/YourController.php

namespace App\Controller;

use Cake\Controller\Controller;
use Cake\Event\EventInterface;

class YourController extends Controller
{
    public function initialize(): void
    {
        parent::initialize();
        $this->loadComponent('CakeCloudinary.Cloudinary');
    }

    // ...
}

Next, upload an asset like so:

$this->Cloudinary->upload($file, ['getUrl' => 'true']);

For more information: Here: cakephp cloudinary plugin

 

Leave A Comment