PHP code example of elfarmawy / vdocipher

1. Go to this page and download the library: Download elfarmawy/vdocipher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elfarmawy / vdocipher example snippets


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

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,
]);

// 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',
    ],
]);

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

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

// 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);
bash
php artisan vendor:publish --provider="ElFarmawy\VdoCipher\Providers\VdoCipherServiceProvider" --tag=config