Overview of the Duration class
Duration class (introduced in version 4.2) extends PHP's DateInterval class. It represents a continuous portion of time between two datepoints and cannot be negative.website·Indexed 37 days ago
https://period.thephpleague.com/A PHP library for handling bounded datetime intervals. It provides a Period value object, DatePoint and Duration classes, and a Sequence class for managing multiple Period instances. Documentation covers versions 3.0, 4.0, and 5.0, including features for comparing periods, drawing intervals, and managing period collections.
Duration class (introduced in version 4.2) extends PHP's DateInterval class. It represents a continuous portion of time between two datepoints and cannot be negative.League
Period is a PHP API for handling time ranges. It is implemented as an immutable value object. Because it is an immutable value object, you must typehint against the League\Period\Period class directly as it does not provide a separate interface.
A Period instance is a PHP implementation of a bounded datetime interval. It consists of two date endpoints (datepoints) expressed as DateTimeImmutable objects, where the starting datepoint must be less than or equal to the ending datepoint.
It supports four boundary configurations:
[start, end)[start, end](start, end](start, end)Infinite or unbounded intervals are not supported. The duration between datepoints is expressed as a DateInterval and cannot be negative.
DatePoint class is a decorator for PHP's DateTimeImmutable object. It provides named constructors for easy instantiation, factory methods to create Period classes, and methods to determine the relationship between a specific point in time and a Period instance.Sequence class is designed to manage and gather information about multiple Period instances. Because Period is a value object, comparisons within a Sequence are performed using Period::equals rather than standard equality operators (== or ===).Sequence class is a container designed to manage and gather information about multiple Period instances. Because Period is a value object, the Sequence class uses Period::equals for comparisons rather than standard identity operators (== or ===).League
Period is a time range API for PHP (minimum version 8.1.0). It provides an immutable value object for handling time intervals. Because the League\Period\Period class is marked as final and has no interface, you should always typehint against the class directly.
League eadthedocs eadthedocs package provides a time range API for PHP. The League eadthedocs eadthedocs class is an immutable value object marked as final; therefore, developers must typehint against the class directly as no interface is provided. For managing collections of Period objects, the library provides the League eadthedocs eadthedocs class.league/period version 3.0, the Period class is an immutable value object. Any modification method does not change the existing object but instead returns a new Period object. If a valid Period cannot be created during a modification, a LogicException is thrown.In the Period library (v3.0), time is managed using two primary concepts:
DateTimeImmutable objects, and the start must be less than or equal to the end.DateInterval object. Durations cannot be negative.Sequence class allows you to manage multiple Period instances. It behaves as a List, similar to an array that uses incremental integer keys. Once instantiated, a Sequence object can be used as a Period-aware Container or a Period Collection.Bounds enumeration defines whether the boundary datepoints of a Period instance are included or excluded. An included datepoint means the boundary itself is part of the interval; an excluded datepoint means it is not.enum Bounds
{
case IncludeStartExcludeEnd;
case IncludeAll;
case ExcludeStartIncludeEnd;
case ExcludeAll;
}