faustbrian/laravel-vidible

Video attachment and management for your Eloquent models.

1.1.0 2018-11-10 06:34 UTC

README

Build Status PHP from Packagist Latest Version License

Installation

Require this package, with Composer, in the root directory of your project.

$ composer require faustbrian/laravel-vidible

To get started, you'll need to publish the vendor assets and modify it:

php artisan vendor:publish --provider="BrianFaust\Vidible\VidibleServiceProvider"

The package configuration will now be located at app/config/vidible.php and the migration at database/migrations/2015_01_30_000000_create_vidible_table.php.

To finish the installation you need to migrate the vidible table by executing:

php artisan migrate

Usage

<?php

namespace App\Http\Controllers;

use App\User;
use BrianFaust\Vidible\VidibleService as Vidible;
use Illuminate\Http\Request;

class VidibleController extends Controller {

    public function index(Request $request, Vidible $vidible)
    {
        // Load the model the video will be attached to
        $user = User::find(1);

        // The video that should be uploaded
        $file = $request->files->all()['video'];

        // Upload the video and create a database record
        $video = $vidible->withFile($file)
                         ->withModel($user)
                         ->withAttributes(['slot' => 'trailer'])
                         ->withFilters(['watermark'])
                         ->commit(true);

        // Get the shareable url of the created video
        $video = $vidible->withFilters(['watermark'])
                         ->getShareableLink($video);

        // Display the shareable url
        echo($video);
    }

}

Testing

$ phpunit

Security

If you discover a security vulnerability within this package, please send an e-mail to hello@brianfaust.me. All security vulnerabilities will be promptly addressed.

Credits

License

MIT © Brian Faust