manchenkov / timer
'Timer' is a class to help build time interval value in seconds by object-oriented style
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/manchenkov/timer
Requires
- php: ^7.4
Requires (Dev)
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2025-09-19 13:50:20 UTC
README
Timer is a class to help build time interval value in seconds by object-oriented style
Installation
You have to run following command to add a dependency to your project
composer require manchenkov/timer
or you can add this line to require
section of composer.json
"manchenkov/timer": "*"
Usage
use Manchenkov\Timer\Timer; $timer = Timer::get()->hours(5)->minutes(10)->seconds(34); $intervalValue = $timer->asNumber(); // <int> -> 18634 = 34 + (10 * 60) + (5 * 3600) $intervalString = $timer->asString(); // <string> -> 05:10:34 // or $intervalString = (string)$timer; // <string> -> 05:10:34
Testing
To run test cases you should execute the following command
./vendor/bin/phpunit tests --testdox