1. Go to this page and download the library: Download fireworkweb/smpte 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/ */
fireworkweb / smpte example snippets
use FireworkWeb\SMPTE\Timecode;
use FireworkWeb\SMPTE\Validations;
// passing frame count
$timecode = new Timecode(360);
// passing a timecode string
$timecode = new Timecode('00:00:01:10');
// passing a Datetime object
$timecode = new Timecode(new \DateTime('01:34:12'));
$timecode = Timecode::fromSeconds(10);
(new Timecode(360))->toString();
// "00:00:15:00"
$tc = new Timecode('00:01:00:00');
// Adding from string
$tc->add('00:00:30:00')->toString();
// 00:01:30:00
// Adding frame count
$tc->add(1)->toString();
// 00:01:30:01
// Adding from another object
$tc2 = new Timecode('00:01:00:00');
$tc->add($tc2)->toString();
// 00:02:30:01
$tc = new Timecode('00:03:00:00');
// Subtracting from string
$tc->subtract('00:00:30:00')->toString();
// 00:02:30:00
// Subtracting frame count
$tc->subtract(1)->toString();
// 00:02:29:23
// Subtracting from another object
$tc2 = new Timecode('00:01:00:00');
$tc->subtract($tc2)->toString();
// 00:01:29:23
$tc = new Timecode('00:03:00:00');
$tc->setHours(1)->toString();
// 01:03:00:00
$tc = new Timecode('00:03:00:00');
$tc->setMinutes(1)->toString();
// 00:01:00:00
$tc = new Timecode('00:03:00:00');
$tc->setSeconds(1)->toString();
// 00:03:01:00
$tc = new Timecode('00:03:00:00');
$tc->setFrames(1)->toString();
// 00:03:00:01
$tc = new Timecode('00:03:00:00');
$tc->setFrameCount(360)->toString();
// 00:00:15:00