PHPackages                             vincenzoraco/date-formatter-php - 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. vincenzoraco/date-formatter-php

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

vincenzoraco/date-formatter-php
===============================

A package to generate an array with different date formats

v1.1.0(2mo ago)184MITPHPPHP ^8.3.0CI passing

Since Mar 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/vincenzoraco/date-formatter-php)[ Packagist](https://packagist.org/packages/vincenzoraco/date-formatter-php)[ RSS](/packages/vincenzoraco-date-formatter-php/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (14)Versions (4)Used By (0)

This package provides a utility to generate an array with different date formats

> **Requires [PHP 8.3+](https://php.net/releases/)**

⚡️ Install the package using [Composer](https://getcomposer.org):

```
composer require vincenzoraco/date-formatter-php
```

Features
--------

[](#features)

- Easily format dates in various formats.
- Out-of-the-box formatters available (see the `/src/Formatters` folder).
- Option to create and use custom formatters by extending `DateFormatterAbstract` or implementing the `DateFormatterInterface`.

Usage
-----

[](#usage)

The `FormatDate` class accepts a `DateTime|DateTimeImmutable|Carbon|CarbonImmutable` object and allows you to add multiple formatters. Here's an example of how to use it:

```
(new FormatDate(CarbonImmutable::now()))
  ->add(new Rfc822Formatter)
  ->add(new Rfc850Formatter)
  ->add(new Iso8601Formatter)
  ->add((new TimestampFormatter)->setKey("unix"))
  ->toArray();

// Result
[
    "rfc_822" => "Sun, 02 Mar 25 09:25:01 +0000",
    "rfc_850" => "Sunday, 02-Mar-25 09:25:01 UTC",
    "iso_8601" => "2025-03-02T09:25:01+00:00",
    "unix" => "1740907501",
]
```

Custom Formatters
-----------------

[](#custom-formatters)

To add a custom formatter, you can either extend the abstract class DateFormatterAbstract, which includes several helper methods, or implement the DateFormatterInterface directly.

Example of a custom formatter:

```
use VincenzoRaco\DateFormatterAbstract;

class CustomFormatter extends DateFormatterAbstract
{
    protected string $key = 'custom_key';

    public function __toString(): string
    {
        return $this->getDate()->format('d/m/Y');
    }
}
```

License
-------

[](#license)

This package was created by **[Vincenzo Raco](https://github.com/vincenzoraco)** and is licensed under the **[MIT License](https://opensource.org/licenses/MIT)**.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance85

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

2

Last Release

78d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5623078?v=4)[Vincenzo Raco](/maintainers/vincenzoraco)[@vincenzoraco](https://github.com/vincenzoraco)

---

Top Contributors

[![vincenzoraco](https://avatars.githubusercontent.com/u/5623078?v=4)](https://github.com/vincenzoraco "vincenzoraco (8 commits)")

---

Tags

phppackagedate

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vincenzoraco-date-formatter-php/health.svg)

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

###  Alternatives

[illuminate/support

The Illuminate Support package.

630113.0M41.3k](/packages/illuminate-support)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k18](/packages/solspace-craft-freeform)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40146.5k2](/packages/erlandmuchasaj-laravel-gzip)[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21031.3k2](/packages/zjkal-time-helper)[limingxinleo/hyperf-utils

Utils for Hyperf.

29137.1k3](/packages/limingxinleo-hyperf-utils)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

1610.0k](/packages/japanese-date-japanese-date)

PHPackages © 2026

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