bagf / juration-php
There is no license information available for the latest version (0.0.1) of this package.
Duration string to time in seconds parser
0.0.1
2017-05-27 16:30 UTC
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2024-11-21 04:45:48 UTC
README
PHP version of the Dom Christie's javascript library: juration-js
This library parses text and extracts the duration as seconds integer but unlike the javascript version it does not use regular expressions to match time patterns so helpful pull requests will be appreciated!
Installation
composer require bagf/juration-php
Testing
composer install
composer test
Usage
Juration\Juration::parse('2min'); // 120 Juration\Juration::parse('2min and 1hr'); // 3720 Juration\Juration::stringify(12); // 12 secs Juration\Juration::stringify(184); // 3 mins 4 secs Juration\Juration::stringify(8400); // 2 hrs 20 mins Juration\Juration::stringify(15854400); // 6 mths 1 day