labrodev / time-converter
Utility library that provides a lightweight method to calculate the great-circle distance between two geographic coordinates using the Haversine formula.
Requires
- php: >=8.1
Requires (Dev)
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^10.5
README
Labrodev\TimeConverter is a strict PHP 8.1+ utility library that provides static helper methods to convert between seconds, minutes, and hours — built for simplicity and performance.
Features
- Convert seconds to minutes
- Convert hours and minutes into raw minute count
- Convert float-based minutes into integer format
- Convert hours (as float) into total minutes
- Fully static and type-safe class
- Lightweight, dependency-free implementation
- Includes PHPUnit and PHPStan support for testing and analysis
Installation
composer require labrodev/time-converter
Usage
use Labrodev\TimeConverter\Converter; // Convert seconds to minutes Converter::secondsToMinutes(180); // 3.0 // Convert hours and minutes to raw minutes Converter::timeToRawMinutes(2, 30); // 150 // Convert float minutes to integer Converter::floatMinutesToInt(12.7); // 13 // Convert hours to minutes Converter::hoursToMinutes(1.5); // 90
Testing
To run tests:
composer install
composer test
Static Analysis
To run static analysis using PHPStan:
composer install
composer analyse
Configuration is located in
phpstan.neon.dist
Security
If you discover a security vulnerability within this package, please contact us immediately at contact@labrodev.com. All security-related issues will be handled privately and promptly.
Credits
This package is maintained by Labrodev — Laravel & PHP development studio.
https://github.com/labrodev
Feedback
If you have any questions, suggestions, or have found an error — feel free to open an issue or contact us:
contact@labrodev.com
License: MIT