1. Go to this page and download the library: Download plutuss/getid3-laravel 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/ */
plutuss / getid3-laravel example snippets
use Plutuss\Facades\MediaAnalyzer;
use Illuminate\Http\Request;
class MediaAnalyzerController extends Controller
{
public function index(Request $request)
{
// To add a file locally it must be in storage.
// So that the Storage facade can read it.
// The default disk value is taken from the .env file FILESYSTEM_DISK
$media = MediaAnalyzer::fromLocalFile('/video.mov');
$media->getAllInfo();
// OR
$media = MediaAnalyzer::fromLocalFile(
path: 'files/video.mov',
disk: 'public', // "local", "ftp", "sftp", "s3"
);
$media->getAllInfo();
// Request file
$media = MediaAnalyzer::uploadFile($request->file('video'));
$media->getAllInfo();
}
}
$url = 'https://www.example.com/filename.mp3';
$media = MediaAnalyzer::fromUrl($url)
$media->getAllInfo();
// or
$media->getNestedValue('array.key')
$url = 'https://www.example.com/filename.mp3';
// The methods only works on the file by reference
// setFilePath()
// setFileName()
MediaAnalyzer::saveFileFromUrl(true) // Default false, if you want to save the file using the link
->setDisk('public') // You specify which disk
->setFilePath('music/') // You specify which path for the file
->setFileName('filename') // You specify what name for the file
->fromUrl($url);