1. Go to this page and download the library: Download codificar/subtitles 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/ */
codificar / subtitles example snippets
// add namespace
use \Done\Subtitles\Subtitles;
Subtitles::convert('subtitles.srt', 'subtitles.vtt');
$subtitles = new Subtitles();
$subtitles->add(0, 5, 'This text is shown in the beggining of video for 5 seconds');
$subtitles->save('subtitles.vtt');
$subtitles = Subtitles::load('subtitles.srt');
$string = "
1
00:02:17,440 --> 00:02:20,375
Senator, we're making our final approach
";
$subtitles = Subtitles::load($string, 'srt');
$subtitles->save('subtitler.vtt');
echo $subtitles->content('vtt');
$subtitles->add(0, 5, 'some text'); // from 0, till 5 seconds
// Add multiline text
$subtitles->add(0, 5, [
'first line',
'second line',
]);
$subtitles->remove(0, 5); // from 0, till 5 seconds