Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Date Value Objects Laravel Package

apie/date-value-objects

Date-related value objects for PHP/Apie that model only the date/time parts you need (LocalDate, Time, HourAndMinutes, UnixTimestamp, DateWithTimezone). Helps validate expected formats without relying on full DateTimeImmutable.

View on GitHub
Deep Wiki
Context7

Latest Stable Version Total Downloads Latest Unstable Version License PHP Composer

PHP Composer

This package is part of the Apie library. The code is maintained in a monorepo, so PR's need to be sent to the monorepo

Documentation

This package contains many Date-related value objects. Why do you want to use these value objects over DateTimeImmutable in PHP? The thing is that DateTime always contains days, months, years, minutes, seconds, hours, a timezone and microseconds. But in most cases we only use some.

By using these value objects over the PHP datetime objects we can tell if the date format we expect is actually using all these properties.

Available classes

DateWithTimezone: contains years, months, days, hours, seconds and also timezones. They should be in the format as DateTime::ATOM as a standard.

HourAndMinutes: contains a timestamp with only hours and minutes. It's still possible to call nextMinute 60 time or nextSecond 3600 time to advance an hour here.

LocalDate: contains a date with the format in a local date format, for example '2002-12-31' for 31 december 2002.

Time: contains a timestamp with only hours, minutes and seconds.

UnixTimestamp: contains a Unix timestamp.

Interfaces

WorksWithDays: contains a list of methods to work with days.

WorksWithMonths: contains a list of methods to work with months. Internally it stores a un-normalized day value in case someone uses nextMonth() or previousMonth() too many times in a row.

WorksWithTimeIntervals: contains a list of methods to work with time periods.

WorksWithYears: contains a list of methods to work with year counting.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log