Skip to content

TarekHesham/laravel-vdocipher

Repository files navigation

VdoCipher for Laravel

Latest Version on Packagist Total Downloads GitHub Tests Action Status

A Laravel package that provides a clean, API-only integration with the VdoCipher video platform. Supports Laravel 10, 11, and 12.

Installation

You can install the package via Composer:

composer require ElFarmawy/vdocipher

Publishing the config file

php artisan vendor:publish --provider="ElFarmawy\VdoCipher\Providers\VdoCipherServiceProvider" --tag=config

This will create a config/vdocipher.php configuration file in your app where you can modify the settings.

Configuration

Update your .env file with your VdoCipher API key:

VDOCIPHER_API_KEY=your-api-key
VDOCIPHER_BASE_URL=https://dev.vdocipher.com/api
VDOCIPHER_OTP_TTL=300

You can also configure default watermarks in the config/vdocipher.php file:

'watermarks' => [
    [
        'type'     => 'rtext',
        'text'     => 'Copyright © ' . date('Y'),
        'alpha'    => '0.6',
        'color'    => '0xFFFFFF',
        'size'     => '15',
        'interval' => '5000',
    ],
],

Usage

Basic Example

use ElFarmawy\VdoCipher\Facades\VdoCipher;

// Get OTP for video playback
$otpInfo = VdoCipher::getOtp('video_id', [
    'userId' => 42,
]);

// Get complete video details including OTP
$details = VdoCipher::getVideoDetails('video_id', [
    'userId' => 42,
]);

// List all videos
$videos = VdoCipher::getVideos([
    'page' => 1,
    'limit' => 10,
]);

Overriding Default Configuration at Runtime

You can override the default configuration at runtime:

// Override API key
VdoCipher::setApiKey('new-api-key');

// Override base URL
VdoCipher::setBaseUrl('https://custom-dev.vdocipher.com/api');

// Override default watermarks
VdoCipher::setWatermarks([
    [
        'type'     => 'rtext',
        'text'     => 'MyCustomText',
        'alpha'    => '0.2',
        'color'    => '0x00FF00',
        'size'     => '40',
        'interval' => '100000',
    ],
]);

Managing Videos

// Get a specific video
$video = VdoCipher::getVideo('video_id');

// Delete a video
$deleted = VdoCipher::deleteVideo('video_id');

Video Upload

// Get upload credentials
$credentials = VdoCipher::getVideoCredentials('My Video Title', '7d52*******'); // folderId Optional

// Upload a video file
$uploadLink = $credentials['clientPayload']['uploadLink'];
$formData = $credentials['clientPayload'];
$file = $request->file('video');

// Added custom redirect if needed
// $formData['success_action_status'] = 201;
// $formData['success_action_redirect'] = '';

$uploadResult = VdoCipher::uploadVideoToApi($uploadLink, $formData, $file);

Full Documentation

For complete documentation and advanced usage, please check the Wiki.

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

About

A lightweight, non-official Laravel wrapper for the VdoCipher video platform. This package provides a fluent, testable API for managing videos, generating playback and offline OTPs, importing videos from URLs, applying watermarks, and tracking viewer-based analytics — all natively within your Laravel application.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages