PHPackages                             leaditin/moment - 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. leaditin/moment

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

leaditin/moment
===============

A simple PHP API for Time, DateTime and DateRange.

2.0.1(1y ago)016MITPHPPHP ^8.1

Since Dec 24Pushed 1y agoCompare

[ Source](https://github.com/leaditin/moment)[ Packagist](https://packagist.org/packages/leaditin/moment)[ RSS](/packages/leaditin-moment/feed)WikiDiscussions master Synced 1mo ago

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

Moment
======

[](#moment)

A simple PHP API for Time, DateTime and DateRange.

[![Build Status](https://camo.githubusercontent.com/12b822b9aa6ccddb1a7a36a4792e82d96cb69609550b028a8066ec0bde14f440/68747470733a2f2f7472617669732d63692e6f72672f6c6561646974696e2f6d6f6d656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/leaditin/moment)[![Code Quality](https://camo.githubusercontent.com/2e7ad04e3bdfd3b70564b6cbb16067f4dd0378d3acacd6f798efe7ea235b6689/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c6561646974696e2f6d6f6d656e742e737667)](https://scrutinizer-ci.com/g/leaditin/moment)[![Code Coverage](https://camo.githubusercontent.com/b3db6da9b660b27b073d8ced3b95eafc38ce0eabff2c5958fba0019c34a37fb5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c6561646974696e2f6d6f6d656e742e737667)](https://scrutinizer-ci.com/g/leaditin/moment/code-structure)[![Latest Version](https://camo.githubusercontent.com/b23aefde93a6bb40b28f827d53873910ce448528fd1c8443880dcbb1594c6a97/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6561646974696e2f6d6f6d656e742e737667)](https://packagist.org/packages/leaditin/moment)[![PDS Skeleton](https://camo.githubusercontent.com/a8ce1f2a7b71f101b18fc0393ba5bf89b7a5b1f9d08a31b658ca0eab0064c0f6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e737667)](https://github.com/php-pds/skeleton)

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

[](#installation)

The preferred method of installation is via [Composer](http://getcomposer.org/). Run the following command to install the latest version of a package and add it to your project's `composer.json`:

```
composer require leaditin/moment
```

Usage
-----

[](#usage)

**Instantiate Time object**

```
use \Leaditin\Moment\Time;

$time = Time::fromSeconds(7200);
$time = Time::fromString('12:25');
```

**Instantiate DateTime object**

```
use \Leaditin\Moment\DateTime;

$now = new DateTime();
$today = new DateTime('now', null, DateTime::TYPE_DATE);
$past = new DateTime('26 Jul 1984', null, DateTime::TYPE_DATE);
```

**Instantiate DateRange object**

```
use \Leaditin\Moment\{DateTime, DateRange};

$range = new DateRange(new DateTime('2016-01-01 00:00:00'), new DateTime('2016-12-31 23:59:59'));
$infinityLeft = new DateRange(null, new DateTime());
$infinityRight = new DateRange(new DateTime(), null);
$infinity = new DateRange();
```

Credits
-------

[](#credits)

- [All Contributors](../../contributors)

License
-------

[](#license)

Released under MIT License - see the [License File](LICENSE) for details.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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 ~1014 days

Total

2

Last Release

582d ago

Major Versions

1.0.1 → 2.0.12024-10-04

PHP version history (2 changes)1.0.1PHP ^7.1

2.0.1PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/05ace5e8872f342734c0424a5d7e6436c39386cf978d4c1675d3d4a9af2fecdb?d=identicon)[igorvuckovic](/maintainers/igorvuckovic)

---

Top Contributors

[![igorvuckovic](https://avatars.githubusercontent.com/u/25580555?v=4)](https://github.com/igorvuckovic "igorvuckovic (3 commits)")

---

Tags

datetimetimedatemomentdate-rangeleaditin

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/leaditin-moment/health.svg)

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

###  Alternatives

[league/period

Time range API for PHP

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

Date and time library

3623.3M60](/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.4M41](/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)
