Skip to content

PHP Library that can parse a time string describing duration to a seconds integer and can do the inverse, describing a duration using a seconds integer.

Notifications You must be signed in to change notification settings

bagf/juration-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

PHP Library that can parse a time string describing duration to a seconds integer and can do the inverse, describing a duration using a seconds integer.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages