Skip to content

DateTime ​

Date, time and datetime primitives for Raxos, built on top of CakePHP Chronos. The package ships three small, immutable value classes (Date, Time and DateTime) that extend Chronos with JSON serialization, string parsing and a regex pattern contract. It also provides Month and Weekday enums, a small DateTimeUtil helper, and optional ORM casters for raxos/database.

Install it with Composer.

shell
composer require raxos/datetime

Highlights ​

Explore by category ​

Quick example ​

php
<?php
declare(strict_types=1);

use Raxos\DateTime\{DateTime, Weekday};

$now = DateTime::now();
$weekday = Weekday::fromChronos($now);

echo $now->toIso8601String();
echo $weekday->name;

This creates the current DateTime and resolves the matching Weekday case.

Next steps ​

See installation for requirements, or use the sidebar to navigate this package.