Skip to content

Releases: phpnomad/chrono

1.0.0

27 May 19:22

Choose a tag to compare

Initial release of the PHPNomad Chrono contract catalog.

What's in the box

A catalog of 32 narrow, composable interfaces covering the cross-library semantic operations of PHP's time ecosystem. Integration packages implement whichever subset their underlying library naturally supports; consumers depend only on the capabilities they actually use.

Clock and provider state

  • ClockStrategy (extends Psr\Clock\ClockInterface)
  • HasTimezone, HasLocale

Predicates

  • CanCheckIfPast, CanCheckIfFuture, CanCheckIfWeekend, CanCheckIfWeekday
  • CanCheckSameDay, CanCheckSameMonth, CanCheckSameYear, CanCheckBetween

Arithmetic

  • CanApplyModifier, CanAddInterval, CanSubtractInterval

Calendar boundaries

  • CanGetStartOfDay, CanGetEndOfDay, CanGetStartOfMonth, CanGetEndOfMonth, CanGetStartOfYear, CanGetEndOfYear

Difference and duration

  • CanGetDifference, CanGetDifferenceInDays, CanGetDifferenceInHours, CanGetDifferenceInMinutes, CanGetDifferenceInSeconds

Parsing and formatting

  • CanParseDate, CanParseDateWithFormat
  • CanFormatDate, CanFormatLocalizedDate, CanFormatRelativeTime

Model contracts (for persisted records)

  • HasCreatedDate, HasModifiedDate

Requirements

PHP 8.2 or newer. One runtime dependency: psr/clock ^1.0.

Pairing

This package ships interfaces only. Pair it with at least one concrete ClockStrategy binding — for example phpnomad/wordpress-integration on WordPress, or any PSR-20 implementation such as lcobucci/clock or symfony/clock elsewhere. Integration packages declare PHPNomad support by implementing any subset of the catalog.