PHPackages                             seiler/eloquent-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. [Database &amp; ORM](/categories/database)
4. /
5. seiler/eloquent-date

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

seiler/eloquent-date
====================

A trait for Eloquent models to help you work with dates in different languages

5.6.0(7y ago)5521[1 PRs](https://github.com/fredericseiler/eloquent-date/pulls)MITPHPPHP ^7.1.3

Since Jun 22Pushed 6y ago1 watchersCompare

[ Source](https://github.com/fredericseiler/eloquent-date)[ Packagist](https://packagist.org/packages/seiler/eloquent-date)[ Docs](https://github.com/fredericseiler/eloquent-date)[ RSS](/packages/seiler-eloquent-date/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (2)Versions (7)Used By (0)

Eloquent-Date
=============

[](#eloquent-date)

[![Latest Version](https://camo.githubusercontent.com/24a639cd0112cc77e43220c74c7b30f0c1da346d20a4973f7da7514cec2b8a36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365696c65722f656c6f7175656e742d646174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/seiler/eloquent-date)[![Software License](https://camo.githubusercontent.com/7971f3faa05300222a69d25fd7a2cd63272040ef418a67fbab059a25522221bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7365696c65722f656c6f7175656e742d646174652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This trait replaces Carbon with [Jenssegers\\Date](https://github.com/jenssegers/date) in Laravel's Eloquent model.

Jenssegers\\Date extends [Carbon](https://github.com/briannesbitt/Carbon) with multi-language support. Methods such as `format`, `diffForHumans`, `parse`, `createFromFormat` and the new `timespan`, will now be translated based on your locale.

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

Laravel compatibility
---------------------

[](#laravel-compatibility)

LaravelEloquent-Date5.65.65.55.55.45.45.35.35.25.2Installation
------------

[](#installation)

Install using composer:

```
$ composer require seiler/eloquent-date
```

If you want to use Jenssegers\\Date in other part of your application, there is a service provider [included in the package](https://github.com/jenssegers/date#laravel) for integration with the Laravel framework. This provider will get the application locale setting and use this for translations. To register the service provider, add the following to the providers array in `config/app.php`:

```
'providers' => [
    ...
    /*
     * Application Service Providers...
     */
    Jenssegers\Date\DateServiceProvider::class,
    ...
];
```

You can also add it as a Facade in `config/app.php`:

```
'aliases' => [
    ...
    'Date' => Jenssegers\Date\Date::class,
    ...
];
```

Languages
---------

[](#languages)

The Date package contains language files for the following languages:

- Albanian
- Arabic
- Azerbaijani
- Bangla
- Basque
- Brazilian Portuguese
- Bulgarian
- Catalan
- Croatian
- Chinese Simplified
- Chinese Traditional
- Czech
- Danish
- Dutch
- English
- Esperanto
- Estonian
- Finnish
- French
- Galician
- Georgian
- German
- Greek
- Hebrew
- Hindi
- Hungarian
- Icelandic
- Indonesian
- Italian
- Japanese
- Kazakh
- Korean
- Latvian
- Lithuanian
- Macedonian
- Malay
- Norwegian
- Nepali (नेपाली)
- Polish
- Portuguese
- Persian (Farsi)
- Romanian
- Russian
- Thai
- Serbian (latin)
- Serbian (cyrillic)
- Slovak
- Slovenian
- Spanish
- Swedish
- Turkish
- Turkmen
- Ukrainian
- Uzbek
- Vietnamese
- Welsh

Usage
-----

[](#usage)

In your Eloquent model, add the `EloquentDate` trait:

```
