NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1471 most downloaded on Packagist
Complex period comparisons
Latest stable
2.4.2
Last release 26 days ago
27 Oct 2026
Ships unpredictably
gaps range from 9 days to 3.7 years
Nearly every release is documented
notes for 43 of 45 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
45 releases · first in 2018
Drag across the ruler to compare, or tap a release to open it.
Return zero length for day, hour, minute, and second periods whose boundary exclusions reverse the included endpoints and whose iterator yields no dat
Full Changelog: https://github.com/spatie/period/compare/2.4.1...2.4.2
Compare period starts at the period precision, consistently with startsAt() and end comparisons (#154).
startsAt() and end comparisons (#154).No breaking API changes. All eight CI matrix jobs and the styling workflow pass.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Refactor tests to pest by @AyoobMH in https://github.com/spatie/period/pull/115
Full Changelog: https://github.com/spatie/period/compare/2.3.5...2.4.0
Revert previous release
Revert previous release
Full Changelog: https://github.com/spatie/period/compare/2.3.3...2.3.4
Full Changelog: https://github.com/spatie/period/compare/2.3.3...2.3.4
Full Changelog: https://github.com/spatie/period/compare/2.3.2...2.3.3
Full Changelog: https://github.com/spatie/period/compare/2.3.2...2.3.3
Error "Undefined array key 0" fix by @aliowacom in https://github.com/spatie/period/pull/105
Full Changelog: https://github.com/spatie/period/compare/2.3.1...2.3.2
Add PHP 8.1 Support by @patinthehat in https://github.com/spatie/period/pull/102
Full Changelog: https://github.com/spatie/period/compare/2.3.0...2.3.1
- Add PeriodCollection::sort()
PeriodCollection::sort() (#97)- Add PeriodCollection::unique()
PeriodCollection::unique() (#96)Don't initialize Period::asString in constructor
Fix subtraction of empty PeriodCollection
reindex collection array after filtering values
Add PeriodCollection::subtract(PeriodCollection|Period $others)
PeriodCollection::subtract(PeriodCollection|Period $others) (#84)PeriodCollection::overlap(PeriodCollection $others)PeriodCollection::overlapAll(PeriodCollection ...$others)Bump required PHP version to ^8.0
^8.0overlapAll when no overlapPeriod or PeriodCollectionPeriod to staticPeriod::duration() returns an instance of PeriodDurationPeriod::length() now uses the Period's precision instead of always returning daysPeriod::overlap() renamed to Period::overlapAny()Period::overlapSingle() renamed to Period::overlap()Period::diff() renamed to Period::subtract()Period::subtract() (previously diff) no longer returns the gap when there's no overlapPeriod::diffSingle() renamed to Period::diffSymmetric()Period::contains() now accepts both DateTimeInterface and PeriodPeriodCollection::overlap() now accepts one or several periodsgetIncludedEnd() and getStart() to includedEnd() and start(), etc.Period::fromString()Period::asString()- Support PHP 8.1 Full Changelog: https://github.com/spatie/period/compare/1.6.0...1.6.1
Full Changelog: https://github.com/spatie/period/compare/1.6.0...1.6.1
- Add Period::renew
Period::renew (#74)- PHP8 compatibility
Keep timezone when boundaries are timezoned
Support multiple precisions when checking touchesWith
Add filter to PeriodCollection
Add filter to PeriodCollection
Fix for PeriodCollection::gaps() with excluded boundaries
~Performance improvement in Period::contains() (#46)~ edit: this change wasn't merged and targeted at 2.0
Period::contains() (#46)~ edit: this change wasn't merged and targeted at 2.0~Improve iterator performance (#42)~ edit: this change wasn't merged and targeted at 2.0
Allow extension of Period that forces extension of DateTimeImmutable
Support PeriodCollection::make()
Add map and reduce to PeriodCollection
map and reduce to PeriodCollection- Remove unused code
- Add period collection add
Add period collection intersect
Even better docblock support for static return types
Better docblock support for static return types
Fix bug with null element in diff
- Make Period iterable
- First stable release
Fix bug with precision not being correctly copied
Add boundary and precision support
No overlap returns empty collection
- Add visualizer
Support edge case for two period diffs
Support better (static) return types in Period
Nothing published for this version
- Add Period::contains
Period::contains- Initial dev release
Nothing published for this version
One column per quarter.