daaquan / chronos-ext
A PHP extension for the Chronos library
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:C
Requires
- php: ^8.0
Requires (Dev)
- pestphp/pest: ^3.8
This package is auto-updated.
Last update: 2025-07-09 01:49:00 UTC
README
Chronos is a lightweight date/time extension for PHP 8+. It extends the native DateTime
class and offers Carbon-like helpers implemented in Zephir.
Building the Extension
- Compile the source and install the module:
cd ext
phpize
./configure
make
sudo make install
- Enable the extension by adding the following line to your
php.ini
:
extension=chronos.so
Building with Docker
docker build -t chronos-ext . # Build using the provided Dockerfile and php.ini
You can then run:
docker run --rm chronos-ext php -m | grep chronos
Usage
<?php $chronos = \Chronos\Chronos::now(); echo $chronos->format('Y-m-d H:i:s');
Running Tests
Install development dependencies and execute the test suite:
composer install php vendor/bin/pest --configuration ide-stubs/phpunit.xml.dist
All tests should pass without failures.
Packaging for PECL
Create the package.xml
file describing the extension and run the pecl package
command from the repository root:
pecl package
This will generate a distributable chronos-0.0.1.tgz
archive that can be uploaded to PECL.