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

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

shafayat/date-formatter
=======================

A custom Laravel package for formatting dates.

v1.0.0(1y ago)02MITPHPPHP &gt;=8.0

Since Dec 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jQsafi/date-formatter)[ Packagist](https://packagist.org/packages/shafayat/date-formatter)[ RSS](/packages/shafayat-date-formatter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

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

[](#installation)

You can install the package via Composer:

```
composer require shafayat/date-formatter
```

---

Configuration
-------------

[](#configuration)

To customize the package's default settings, publish the configuration file:

```
php artisan vendor:publish --tag=config
```

This will create a `config/dateformatter.php` file where you can define your date formats:

```
return [
    'default_format' => 'Y-m-d',
    'styles' => [
        'short' => 'm/d/Y',
        'long' => 'F d, Y',
        'custom' => 'd-m-Y H:i:s',
    ],
];
```

---

Usage
-----

[](#usage)

### Formatting a Date

[](#formatting-a-date)

You can format dates using the `format` method:

```
use Shafayat\DateFormatter\DateFormatter;

// Format a string date
echo DateFormatter::format('2024-01-01', 'short'); // Output: 01/01/2024

// Format a DateTime instance
$date = new \DateTime('2024-01-01');
echo DateFormatter::format($date, 'long'); // Output: January 01, 2024
```

### Default Format

[](#default-format)

If no style is specified, the `default_format` from the configuration will be used:

```
echo DateFormatter::format('2024-01-01'); // Output: 2024-01-01
```

---

Testing
-------

[](#testing)

This package comes with unit tests. To run them, navigate to the package directory and execute:

```
vendor/bin/phpunit
```

---

Roadmap
-------

[](#roadmap)

- Add support for localization.
- Introduce customizable input date parsing.
- Add timezone-aware date formatting.

---

Contributing
------------

[](#contributing)

Contributions are welcome! Please follow these steps:

1. Fork the repository.
2. Create a feature branch: `git checkout -b feature-name`.
3. Commit your changes: `git commit -m 'Add feature name'`.
4. Push to the branch: `git push origin feature-name`.
5. Create a pull request.

---

License
-------

[](#license)

This package is open-source software licensed under the [MIT License](LICENSE).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance41

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

518d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e1cc3354e181539a3b4bb1a7d0c49943878456722694ab30e5d32ccee8947b2a?d=identicon)[jQsafi](/maintainers/jQsafi)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M682](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M157](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M210](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M857](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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