Period

PHP 的时间范围 API。(PHP's time range API)

Github星跟蹤圖

Period

Author
Latest Version
Software License
Build Status
Coverage Status
Infection MSI
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.

Highlights

  • 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

Documentation

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

System Requirements

You need PHP >= 7.2.5 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::create('2012-05-23')->getDay()->getDateInterval();
//returns new DateInterval('P1D');

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

Testing

Period has:

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 and CONDUCT for details.

Security

If you discover any security related issues, please email nyamsprod@gmail.com instead of using the issue tracker.

Changelog

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

Credits

License

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

主要指標

概覽
名稱與所有者thephpleague/period
主編程語言PHP
編程語言PHP (語言數: 1)
平台BSD, Linux, Mac, Windows
許可證MIT License
所有者活动
創建於2014-09-19 13:20:25
推送於2024-12-08 14:24:41
最后一次提交2024-12-08 15:24:36
發布數44
最新版本名稱5.3.2 (發布於 )
第一版名稱0.1.0 (發布於 )
用户参与
星數727
關注者數18
派生數43
提交數889
已啟用問題?
問題數58
打開的問題數0
拉請求數69
打開的拉請求數0
關閉的拉請求數9
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?