PHPackages                             leafs/date - 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. [Framework](/categories/framework)
4. /
5. leafs/date

ActiveLibrary[Framework](/categories/framework)

leafs/date
==========

Leaf PHP date module

v4.0(1y ago)427.4k—1.5%23MITPHPCI passing

Since Sep 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/leafsphp/date)[ Packagist](https://packagist.org/packages/leafs/date)[ Docs](https://leafphp.netlify.app/#/)[ GitHub Sponsors](https://github.com/leafsphp)[ Fund](https://opencollective.com/leaf)[ RSS](/packages/leafs-date/feed)WikiDiscussions v4.x Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (8)Used By (3)

 [![](https://camo.githubusercontent.com/d98ee5e32c2ff016fdfdac6c42654a908f4cc34b229c7b00caacc5a717455ae8/68747470733a2f2f6c6561667068702e6465762f6c6f676f2d636972636c652e706e67)](https://camo.githubusercontent.com/d98ee5e32c2ff016fdfdac6c42654a908f4cc34b229c7b00caacc5a717455ae8/68747470733a2f2f6c6561667068702e6465762f6c6f676f2d636972636c652e706e67)

⏰ Tick
======

[](#-tick)

 **A powerful, elegant date/time manipulation library for PHP with a familiar JavaScript-like API**

 [![Latest Stable Version](https://camo.githubusercontent.com/51ef0ef66eae3e28c118cc0833c757864ae16422a6d17bc066ef219750b73d49/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f646174652f762f737461626c65)](https://packagist.org/packages/leafs/date) [![Total Downloads](https://camo.githubusercontent.com/cb422b28cf539135a1e8beb406542c92f328d27e5916b115355d1dd50fc4864f/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f646174652f646f776e6c6f616473)](https://packagist.org/packages/leafs/date) [![License](https://camo.githubusercontent.com/a6acd903686cae484f6312742937478a786bd27602f07b04fdaf2be7d965b4a7/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f646174652f6c6963656e7365)](https://packagist.org/packages/leafs/date)

🌟 Why Tick?
-----------

[](#-why-tick)

**Tick** is a modern, lightweight PHP date/time library designed to make working with dates and times as painless as possible. If you're familiar with JavaScript libraries like Moment.js or Day.js, you'll feel right at home with Tick.

```
// Get current date in a specific format
echo tick()->format('MMMM Do, YYYY'); // March 31st, 2025

// Chain methods for complex operations
$nextFriday = tick()->add(1, 'week')->startOf('week')->add(4, 'day');
echo $nextFriday->format('dddd, MMMM D'); // Friday, April 11
```

🚀 Installation
--------------

[](#-installation)

**Using [Leaf CLI](https://cli.leafphp.dev) (Recommended)**:

```
leaf install date
```

**Using [Composer](https://getcomposer.org/)**:

```
composer require leafs/date
```

🏁 Quick Start
-------------

[](#-quick-start)

```
// Current date and time
echo tick()->now(); // 2025-03-31T12:29:29+00:00

// Parse a specific date
$birthday = tick('1990-05-15');
echo $birthday->format('MMMM D, YYYY'); // May 15, 1990

// Manipulate dates
$futureDate = tick()->add(3, 'months')->subtract(2, 'days');
echo $futureDate->format('YYYY-MM-DD'); // 2025-06-29
```

✨ Features
----------

[](#-features)

- **🔄 Familiar API** - If you know Day.js or Moment.js, you already know Tick
- **🪶 Lightweight** - No heavy dependencies, just pure PHP goodness
- **🔌 Native Integration** - Seamless integration with PHP's DateTime objects
- **🌐 Timezone Support** - Work with dates across different timezones effortlessly
- **📊 Date Comparison** - Easily compare dates with intuitive methods
- **🧩 Extensible** - Add your own custom functionality when needed
- **🔍 Validation** - Validate dates with built-in methods
- **📝 Formatting** - Format dates in any way you need

📚 API Reference
---------------

[](#-api-reference)

### Creating Dates

[](#creating-dates)

```
// Current date and time
tick();
tick()->now();

// From string
tick('2025-03-31');
tick('2025/03/31');
tick('March 31, 2025');

// From DateTime
tick(new DateTime('2025-03-31'));

// From tick object
$tomorrow = tick('2025-03-31')->add(1, 'day');
tick($tomorrow);
```

### Formatting

[](#formatting)

```
$date = tick('2025-03-31');

// Standard formats
$date->format('YYYY-MM-DD');          // 2025-03-31
$date->format('MMMM D, YYYY');        // March 31, 2025
$date->format('ddd, MMM D, YYYY');    // Mon, Mar 31, 2025
$date->format('YYYY-MM-DD HH:mm:ss'); // 2025-03-31 12:29:29

// Predefined formats
$date->toDateString();                // 2025-03-31
$date->toTimeString();                // 12:29:29
$date->toDateTimeString();            // 2025-03-31 12:29:29
$date->toISOString();                 // 2025-03-31T12:29:29.000Z
```

### Manipulating Dates

[](#manipulating-dates)

```
$date = tick('2025-03-31');

// Add time
$date->add(1, 'day');     // 2025-04-01
$date->add(2, 'months');  // 2025-05-31
$date->add(1, 'year');    // 2026-03-31

// Subtract time
$date->subtract(1, 'week');  // 2025-03-24
$date->subtract(3, 'hours'); // 2025-03-31 09:29:29

// Start/End of time units
$date->startOf('month');    // 2025-03-01 00:00:00
$date->endOf('year');       // 2025-12-31 23:59:59.999999
$date->startOf('day');      // 2025-03-31 00:00:00
```

### Comparing Dates

[](#comparing-dates)

```
$date = tick('2025-03-31');

$date->isBefore('2025-04-01');        // true
$date->isAfter('2025-03-30');         // true
$date->isSame('2025-03-31');          // true
$date->isBetween('2025-03-30', '2025-04-01'); // true
```

### Working with Timezones

[](#working-with-timezones)

```
// Create a date in a specific timezone
$tokyoTime = tick('2025-03-31', 'Asia/Tokyo');

// Convert between timezones
$newYorkTime = $tokyoTime->setTimezone('America/New_York');
```

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

---

 Made with ❤️ by [Leaf PHP](https://leafphp.dev)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance46

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98% 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 ~257 days

Recently: every ~182 days

Total

6

Last Release

413d ago

Major Versions

v1.0 → v2.02023-04-02

v2.2 → v4.02025-03-31

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29547806?v=4)[Mychi](/maintainers/Mychi)[@mychi](https://github.com/mychi)

---

Top Contributors

[![mychidarko](https://avatars.githubusercontent.com/u/26604242?v=4)](https://github.com/mychidarko "mychidarko (49 commits)")[![Awilum](https://avatars.githubusercontent.com/u/477114?v=4)](https://github.com/Awilum "Awilum (1 commits)")

---

Tags

dateleafphpphpphpframeworkdatetimetimedateleaf

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/leafs-date/health.svg)

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

###  Alternatives

[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[leafs/leaf

Elegant PHP for modern developers

1.3k44.3k9](/packages/leafs-leaf)

PHPackages © 2026

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