Popularity
5.4
Stable
Activity
6.6
-
714
19
45

Description

Period is PHP's missing time range API. This package covers all basic operations regarding time ranges.

Programming language: PHP
License: MIT License
Tags: Date And Time     Time     Duration     Calendar     Range     Interval    
Latest version: v5.1.0

Period alternatives and similar libraries

Based on the "Date and Time" category.
Alternatively, view period alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Period or a related project?

Add another 'Date and Time' Library

README

Period

Author Latest Version [Software License](LICENSE) Build Total Downloads

Period is PHP's missing time range API. This package covers all basic operations regarding time ranges.

Highlights

  • Represents Interval and Bounds as immutable value objects or enumeration
  • Exposes named constructors to ease instantiation
  • Covers all basic manipulations related to time range
  • Enables working with simple or complex time ranges logic
  • Fully documented
  • Framework-agnostic

Documentation

Full documentation can be found at period.thephpleague.com.

System Requirements

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

Install

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;

Datepoint::fromDateString('2012-05-23')->month()->toIso80000('Y-m-d');
//returns [2012-05-01, 2012-06-01)

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

Testing

Period has:

  • a PHPUnit test suite
  • a code analysis compliance test suite using PHPStan.
  • a coding style compliance test suite using PHP CS Fixer.

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

$ composer test

Contributing

Contributions are welcome and will be fully credited. Please see [CONTRIBUTING](.github/CONTRIBUTING.md) and [CONDUCT](.github/CODE_OF_CONDUCT.md) for details.

Security

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

Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits

License

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


*Note that all licence references and agreements mentioned in the Period README section above are relevant to that project's source code only.