Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 813 Bytes

README.md

File metadata and controls

26 lines (21 loc) · 813 Bytes

Juration PHP Library

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