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.0.0(1y ago)165MITPHPPHP ^8.3.0CI failing

Since Mar 2Pushed 1y 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 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)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

31

—

LowBetter than 68% of packages

Maintenance46

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

433d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c687c2983ce5409447d3fc2d5129e34103a8dd9b16db7438d23fbace0412f4e?d=identicon)[vincenzoraco](/maintainers/vincenzoraco)

---

Top Contributors

[![vincenzoraco](https://avatars.githubusercontent.com/u/5623078?v=4)](https://github.com/vincenzoraco "vincenzoraco (1 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

[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)[zjkal/time-helper

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

21128.6k1](/packages/zjkal-time-helper)[wilianx7/php-recurring

PHP library to make getting dates easier when working with recurring tasks.

1045.0k](/packages/wilianx7-php-recurring)[maherelgamil/arabicdatetime

Easy and useful tool to generate arabic or hijri date with multi-language support for laravel

414.5k](/packages/maherelgamil-arabicdatetime)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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