delphiki / subrip-file-parser
A library for SubRip (srt) files manipulation
Installs: 75 109
Dependents: 0
Suggesters: 0
Security: 0
Stars: 64
Watchers: 5
Forks: 25
Open Issues: 0
Type:project
This package is auto-updated.
Last update: 2019-08-30 13:17:24 UTC
README
SubRip File PHP Parser
Julien Villetorte, 2010 (gdelphiki@gmail.com)
Installation with composer:
add this to your composer.json file:
"require": { "delphiki/subrip-file-parser": "1.*" }
run
php composer update
Usage:
<?php require('src/SrtParser/srtFile.php'); try{ $file = new \SrtParser\srtFile('./subtitles.srt'); // 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"; }