celest-time / celest

Celest provides a alternative date and time API for PHP.
http://celest-time.org/
GNU General Public License v2.0
9 stars 1 forks source link

Celest

Build Status Scrutinizer Code Quality Code Coverage

Celest provides a alternative date and time API for PHP. It allows you to correctly manage date and time and to do operations on them. It is based on the JSR-310 project for Java 8.

Installation

The recommended way to install Celest is through Composer:

composer require celest/celest

Requirements

PHP >= 5.6 with GMP and intl extension or a current release of HHVM

Timezone Data

Celest uses IANA's time zone database. Changes are distributed via the Celest tzdata repo.

Localization

Besides the ISO 8061 calendar, the Minguo and Thai Buddhist calendars are supported. Localization of Month, weekday etc., localized parsing/formatting patterns and names of time zones are supported and provided via the intl extension.

Testing

You need to install phpunit manually and a version of doctrine/instantiator that's compatible with php5:

composer require --dev phpunit/phpunit:^5.7 rianium/paratest:~0.15.0 doctrine/instantiator:~1.0.5

Then run make test for the full testsuite or make test-short for a testsuite that runs in under a minute. Warning: Paratest currently doesn't display skipped or incomplete tests in all cases.

Interoperability with native \DateTime

As PHP's native \DateTime mixes Instants with local Date/Time there's two different conversions:

Known limitations

Roadmap

Similar projects:

In other languages:

Acknowledgements

Thanks to Stephen Colebourne and Michael Nascimento Santos the original authors of JSR-310. Also to Flixbus who partially sponsored the work on Celest.