1. Go to this page and download the library: Download tonymans33/video-optimizer 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/ */
tonymans33 / video-optimizer example snippets
use Tonymans33\VideoOptimizer\Components\VideoOptimizer;
VideoOptimizer::make('video')
->disk('public')
->directory('videos')
->optimize('medium') // 'low', 'medium', 'high', or null
->format('webm'); // 'webm', 'mp4', or null
use Tonymans33\VideoOptimizer\Components\SpatieMediaLibraryFileUpload;
SpatieMediaLibraryFileUpload::make('videos')
->collection('videos')
->multiple()
->optimize('medium')
->format('webm');
use Tonymans33\VideoOptimizer\Facades\VideoOptimizer;
VideoOptimizer::make('video')
->optimize('high')
->format('mp4');
// Queue jobs for async processing
VideoOptimizer::make('video')
->optimize('medium')
->format('webm')
// Process after form submission using queued jobs
->saveUploadedFileUsing(function ($file) {
dispatch(new OptimizeVideoJob($file));
});
// In your service provider or config
ini_set('memory_limit', '512M');