phellow / date
Helps to work with dates
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/phellow/date
Requires (Dev)
- phpunit/phpunit: 4.4.*
This package is auto-updated.
Last update: 2025-10-09 00:52:03 UTC
README
This small library will help you to work with date/time specific objects.
Install via Composer
Add the following dependency to your project's composer.json file:
{ "require": { "phellow/date": "1.*" } }
Usage
Use the DateFactory to create all objects. You can add the factory to your Dependency Injection Container.
$factory = new \Phellow\Date\DateFactory(); // create a DateTime object $dt = $factory->createDateTime(); $dt = $factory->createDateTime('now'); $dt = $factory->createDateTime('2014-12-8'); $dt = $factory->createDateTime(time()); $dt = $factory->createDateTime($dt); // create a Month object $month = $factory->createMonth(); $month = $factory->createMonth('now'); $month = $factory->createMonth('2014-12-8'); $month = $factory->createMonth(time()); $month = $factory->createMonth($dt);
To see all the possibilities, you can check out the Unit Tests under tests/.
License
The MIT license.