filmtools / secondstominutes
Formats seconds to 'mm:ss' or 'hh:mm:ss'
1.0.1
2019-04-23 21:42 UTC
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^5.7|^6.0|^7.0
- spatie/phpunit-watcher: ^1.8
This package is auto-updated.
Last update: 2024-12-24 10:35:23 UTC
README
Formats seconds to 'mm:ss' or 'hh:mm:ss'
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