12/03
2014
A library for SubRip (srt) files manipulation
Julien Villetorte, 2010 (gdelphiki@gmail.com), (*1)
add this to your composer.json file: ``` json "require": { "delphiki/subrip-file-parser": "1.*" }, (*2)
run ``` sh php composer update
``` php <?php, (*3)
require('src/SrtParser/srtFile.php');, (*4)
try{ $file = new \SrtParser\srtFile('./subtitles.srt');, (*5)
// display the text of the first entry echo $file->getSub(0)->getText(); // merge 2 files and save the new generated file $file2 = new srtFile('./subtitles2.srt'); $file->mergeSrtFile($file2); $file->build(); $file->save('./new_subtitles.srt');
} catch(Exception $e){ echo 'Error: '.$e->getMessage()."\n"; } ```, (*6)