Awesome Open Source
Awesome Open Source


Author Latest Version Software License Build Total Downloads

Period is PHP's missing time range API. Based on ideas from Resolving Feature Envy in the Domain by Mathias Verraes, this package extends the concept to cover all basic operations regarding time ranges.


  • Represents Interval, Datepoint, Duration and Collection as value objects
  • Exposes named constructors to ease object creation
  • Covers all basic manipulations related to time range
  • Enables working with simple or complex time ranges logic
  • Fully documented
  • Framework-agnostic


Full documentation can be found at

System Requirements

You need PHP >= 8.0.0 but the latest stable version of PHP is recommended.


Install Period using Composer.

$ composer require league/period

or download the library and:

  • use any other PSR-4 compatible autoloader.
  • use the bundle autoloader script as shown below:
require 'path/to/period/repo/autoload.php';

use League\Period\Datepoint;

//returns new DateInterval('P1D');

where path/to/period/repo represents the path where the library was extracted.


Period has:

To run the tests, run the following command from the project folder.

$ composer test


Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.


If you discover any security related issues, please email [email protected] instead of using the issue tracker.


Please see CHANGELOG for more information on what has changed recently.



The MIT License (MIT). Please see LICENSE for more information.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Php (404,845
Calendar (1,943
Time (1,450
Collection (1,324
Date (983
Datetime (647
Timeline (515
Range (424
Sequence (286
Interval (216
Related Projects