PHPackages                             maidmaid/phperiod - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. maidmaid/phperiod

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

maidmaid/phperiod
=================

Showing translated and ranged DateTime in PHP.

v0.1.1(9y ago)11781[1 issues](https://github.com/maidmaid/phperiod/issues)MITPHPPHP &gt;=5.3.0

Since Oct 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/maidmaid/phperiod)[ Packagist](https://packagist.org/packages/maidmaid/phperiod)[ Docs](https://github.com/maidmaid/phperiod)[ RSS](/packages/maidmaid-phperiod/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Phperiod
========

[](#phperiod)

[![Build Status](https://camo.githubusercontent.com/b5445bb4c4bf4882c3a862535dbc7847b77c3519c07c32840b049c0236009a3e/68747470733a2f2f7472617669732d63692e6f72672f6d6169646d6169642f7068706572696f642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/maidmaid/phperiod)

Showing translated and ranged DateTime in PHP.

Require PHP &gt;= 5.6 with Intl extension.

Installation
------------

[](#installation)

Use [Composer](http://getcomposer.org/) to install Phperiod in your project:

```
composer require "maidmaid/phperiod"
```

Usage
-----

[](#usage)

Same day:

```
echo Phperiod::period('2016-10-15');
// Saturday, October 15, 2016

echo Phperiod::period('2016-10-15 12:00');
// Saturday, October 15, 2016 at 12:00 PM

echo Phperiod::period('2016-10-15 12:00', '2016-10-15 13:00');
// Saturday, October 15, 2016 from 12:00 PM to 1:00 PM
```

Ranged dates:

```
echo Phperiod::period('2016-10-15', '2016-10-17');
// from Saturday, October 15, 2016 to Monday, October 17, 2016

echo Phperiod::period('2016-10-15 12:00', '2016-10-17');
// from Saturday, October 15, 2016 to Monday, October 17, 2016 at 12:00 PM

echo Phperiod::period('2016-10-15 12:00', '2016-10-17 13:00');
// from Saturday, October 15, 2016 to Monday, October 17, 2016 from 12:00 PM to 1:00 PM
```

Ranged dates with days of week:

```
echo Phperiod::period('2016-10-15', '2016-10-29', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday, from Saturday, October 15, 2016 to Saturday, October 29, 2016

echo Phperiod::period('2016-10-15 12:00', '2016-10-29', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday at 12:00 PM, from Saturday, October 15, 2016 to Saturday, October 29, 2016

echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday from 12:00 PM to 1:00 PM, from Saturday, October 15, 2016 to Saturday, October 29, 2016
```

With custom format:

```
$formatter = new \IntlDateFormatter('en', \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat'], $formatter);
// Monday, Thursday and Saturday from 12:00 PM to 1:00 PM, from 10/15/16 to 10/29/16
```

Translated dates:

```
$fr = new \IntlDateFormatter('fr');
echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat'], $fr);
// lundi, jeudi et samedi de 12:00 à 13:00, du samedi 15 octobre 2016 au samedi 29 octobre 2016

// if special keywords don't have translation, they are remplaced by generic
// symbols ('from' and 'to' remplaced by '→'), like with Zulu locale
$zu = new \IntlDateFormatter('zu', \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
echo Phperiod::period('2016-10-15 12:00', '2016-10-17 13:00', [], $zu);
// 10/15/16 → 10/17/16 12:00 Ntambama → 1:00 Ntambama
```

License
-------

[](#license)

Phperiod is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~180 days

Total

2

Last Release

3306d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d6c7d985fab45902191a550a2937bac292277eb9b5c1f041b380008f9ba38f7?d=identicon)[maidmaid](/maintainers/maidmaid)

---

Top Contributors

[![maidmaid](https://avatars.githubusercontent.com/u/4578773?v=4)](https://github.com/maidmaid "maidmaid (26 commits)")

---

Tags

phpphp-libraryintldatetimetimedaterange

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maidmaid-phperiod/health.svg)

```
[![Health](https://phpackages.com/badges/maidmaid-phperiod/health.svg)](https://phpackages.com/packages/maidmaid-phperiod)
```

###  Alternatives

[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[kartik-v/yii2-date-range

An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.

894.4M42](/packages/kartik-v-yii2-date-range)[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.5M3](/packages/kartik-v-php-date-formatter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
