laravel-srt-parser maintained by codebuglab
Description
Simple package to parse SubRip or srt file in Laravel
Author
Last update
2022/01/19 18:04
(dev-main)
License
Downloads
152
Tags
php - parser - laravel - subtitles - subtitle - srt - subrip - subtitles-parsing - subtitle-parsing - subtitles-parser - subtitle-parser - srt-parser - subrip-parser
⚡⚡⚡ Laravel Srt Parser
Simple package to parse SubRip or srt file in Laravel

Table of contents
Setup
Installation
To install this package through composer run the following command in the terminal
composer require codebuglab/laravel-srt-parser
Instructions
- To use Srt Parser you have to include next facade file
use CodeBugLab\SrtParser\Facades\SrtParser;
Convert to Array
- This is how you can convert srt to array and read every subtitle details.
$path = storage_path('app/Cars (2006).srt'); // file path
$srt = SrtParser::load($path)->toArray();
- Next is a simple array response you can get from this parser containing subtitle number, start time, stop time, duration of the words appearing in seconds and finally an array of text.
Array
(
[0] => Array
(
[number] => 1
[startTime] => 00:00:38,365
[stopTime] => 00:00:41,495
[duration] => 3.1299998760223
[text] => Array
(
[0] => OK... Here we go. Focus.
)
)
[1] => Array
(
[number] => 2
[startTime] => 00:00:41,575
[stopTime] => 00:00:44,935
[duration] => 3.3599998950958
[text] => Array
(
[0] => Speed. I am speed.
)
)
.
.
.
)
License
This package is a free software distributed under the terms of the MIT license.