PHP code example of codebuglab / laravel-srt-parser

1. Go to this page and download the library: Download codebuglab/laravel-srt-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codebuglab / laravel-srt-parser example snippets


use CodeBugLab\SrtParser\Facades\SrtParser;

$path = storage_path('app/Cars (2006).srt'); // file path

$srt = SrtParser::load($path)->toArray();

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.
                )

        )
    .
    .   
    .
)