delphiki / SubRip-File-Parser

PHP Class allowing SubRip files (.srt) manipulation

Home Page:http://www.lackofinspiration.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository is no longer maintained. The project moved to captioning/captioning

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";
}

About

PHP Class allowing SubRip files (.srt) manipulation

http://www.lackofinspiration.com


Languages

Language:PHP 100.0%