pouyacodes / suber
Working with subtitles in php
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/pouyacodes/suber
This package is not auto-updated.
Last update: 2025-12-20 13:40:26 UTC
README
Working with subtitles in php
Installation
First of all you must install Composer.
Installing via Composer
run composer require pouyacodes/suber
Installing with git
- Close this project
git clone https://github.com/pouyacodes/suber.git - run
composer dump-autoload - autoload classes.
Usage
Here are a simple usage of this package:
<?php require_once 'vendor/autoload.php'; // Put Composer autoloader here, this can be different on your system. $content = file_get_contents("sample.srt"); // Read subtitle file's content to parse. $parser = new SrtParser; // Instantiate of SrtParser $subtitles = $parser->parse($content); // Pass content to parse. foreach($subtitles as $subtitle) { // loop through it. In this example all subtitles will delay 0.5 seconds (500 milliseconds). $subtitle->setFrom( $subtitle->getFrom() + 0.5 ); $subtitle->setTo( $subtitle->getTo() + 0.5 ); } $content = $parser->dump($subtitles); // Pass subtitle collection to dump method to get raw contents. file_put_contents("sample.fixed.srt", $content); // Save raw contents to file. ?>