PHP code example of laracasts / transcriptions

1. Go to this page and download the library: Download laracasts/transcriptions 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/ */

    

laracasts / transcriptions example snippets


use Laracasts\Transcriptions\Transcription;

$transcription = Transcription::load('path/to/file.vtt');

foreach ($transcription->lines() as $line) {
    // $line->body
    // $line->toHtml()
    
    // $line->timestamp->begin()
    // $line->timestamp->beginSeconds()
    // $line->timestamp->end()
    // $line->timestamp->endSeconds()
    
    // json_encode($line);
}

// Group lines into full sentences.
// $transcription->lines()->groupBySentence();