filmtools/secondstominutes

Formats seconds to 'mm:ss' or 'hh:mm:ss'

1.0.1 2019-04-23 21:42 UTC

This package is auto-updated.

Last update: 2024-04-24 09:13:39 UTC


README

Formats seconds to 'mm:ss' or 'hh:mm:ss'

Build Status Scrutinizer Code Quality Code Coverage Build Status

Installation

$ composer require filmtools/secondstominutes

Usage

The seconds2minutes function is namespaced, so you will have to mention it in your use statements. The callable class SecondsToMinutes is a wrapper around the function; It can be used as Twig Filter.

use function FilmTools\SecondsToMinutes\seconds2minutes;
use FilmTools\SecondsToMinutes\SecondsToMinutes;

echo seconds2minutes( 3900 ); // "01:05:00"

$formatter = new SecondsToMinutes;
echo $formatter( 90 ); // "01:30"

$filter = new \Twig\TwigFilter('secondstominutes', new SecondsToMinutes);
$twig->addFilter( $filter );

Development and Unit testing

$ git clone https://github.com/filmtools/secondstominutes.git
$ cd secondstominutes
$ composer install

# either, or, and:
$ composer phpunit
$ vendor/bin/phpunit