jasonadriaan/videocloudcms

A simple way to interact with Brightcove's VideoCloud CMS API

dev-main 2023-07-03 16:18 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package makes it simple for you to retrieve and update videos on Brightcove VideoCloud's CMS API without having to deal with authentication or repetitive api calls.

Support: Buy me a coffee

I build and maintain this project in my free time. If it makes your life simpler you can buy me a coffee.

Installation

You can install the package via composer:

composer require jasonadriaan/videocloudcms

You can publish the config file with:

php artisan vendor:publish --tag="videocloudcms-config"

In your .env file please add the following lines with your API details from Brightcove VideoCloud

VIDEOCLOUD_ACCOUNT_ID=xxxxx
VIDEOCLOUD_API_KEY=xxxxx
VIDEOCLOUD_API_SECRET=xxxxx

Usage

I would recommend you go ahead and read the VideoCloud CMS API documentation to understand the underlying API.

Updating a Video:

use Jasonadriaan\VideoCloudCMS\VideoCloudCMS;

class main extends Controller
{
    
    public function index(){

        $payload = array(
            'name' => 'Scooby Doo!',
          );

        $videocloud = new VideoCloudCMS();

        /*  Update requires a video id and a payload 
        *  eg. update($video_id, $payload) 
        */

        $result = $videocloud->update(1234567890, $payload);

        return $result;
    }

}

Get a list of videos:

use Jasonadriaan\VideoCloudCMS\VideoCloudCMS;

class main extends Controller
{
    
    public function index(){

        $videocloud = new VideoCloudCMS();

        $result = $videocloud->limit(5)
                            ->offset(2)
                            ->query()
                            ->sort()
                            ->getVideos();

        return $result;
    }

}

Get a specific video:

use Jasonadriaan\VideoCloudCMS\VideoCloudCMS;

class main extends Controller
{
    
    public function index(){

        $videocloud = new VideoCloudCMS();

        /* getVideo requires a video id
        *  eg. getVideo($video_id) 
        */

        $result = $videocloud->getVideo(1234567);

        return $result;
    }

}

Get a count of how many videos are on the system:

use Jasonadriaan\VideoCloudCMS\VideoCloudCMS;

class main extends Controller
{
    
    public function index(){

        $videocloud = new VideoCloudCMS();

        $result = $videocloud->getCount();

        return $result;
    }

}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.