{"id":37002094,"url":"https://github.com/fredericseiler/eloquent-date","last_synced_at":"2026-01-14T00:27:34.829Z","repository":{"id":62541936,"uuid":"95161869","full_name":"fredericseiler/eloquent-date","owner":"fredericseiler","description":"A trait for Eloquent models to help you work with dates in multiple languages, based on Carbon.","archived":true,"fork":false,"pushed_at":"2020-04-19T11:43:33.000Z","size":9,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T14:52:13.532Z","etag":null,"topics":["carbon","dates","eloquent","i18n","internationalization","laravel"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/seiler/datetrait","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fredericseiler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-22T22:29:46.000Z","updated_at":"2024-01-24T20:03:17.000Z","dependencies_parsed_at":"2022-11-02T15:46:54.359Z","dependency_job_id":null,"html_url":"https://github.com/fredericseiler/eloquent-date","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fredericseiler/eloquent-date","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredericseiler%2Feloquent-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredericseiler%2Feloquent-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredericseiler%2Feloquent-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredericseiler%2Feloquent-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredericseiler","download_url":"https://codeload.github.com/fredericseiler/eloquent-date/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredericseiler%2Feloquent-date/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carbon","dates","eloquent","i18n","internationalization","laravel"],"created_at":"2026-01-14T00:27:34.041Z","updated_at":"2026-01-14T00:27:34.784Z","avatar_url":"https://github.com/fredericseiler.png","language":"PHP","readme":"# Eloquent-Date\n\n[![Latest Version][ico-version]](https://packagist.org/packages/seiler/eloquent-date)\n[![Software License][ico-license]](LICENSE.md)\n\nThis trait replaces Carbon with [Jenssegers\\Date](https://github.com/jenssegers/date) in Laravel's Eloquent model.\n\nJenssegers\\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.\n\nThis package is compliant with [PSR-1], [PSR-2] and [PSR-4].\nIf you notice compliance oversights, please send a patch via pull request.\n\n[PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md\n[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md\n[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md\n\n## Laravel compatibility\n\n Laravel | Eloquent-Date\n:--------|:--------\n 5.6     | 5.6\n 5.5     | 5.5\n 5.4     | 5.4\n 5.3     | 5.3\n 5.2     | 5.2\n\n## Installation\n\nInstall using composer:\n\n```bash\n$ composer require seiler/eloquent-date\n```\n\nIf 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`:\n\n```php\n'providers' =\u003e [\n    ...\n    /*\n     * Application Service Providers...\n     */\n    Jenssegers\\Date\\DateServiceProvider::class,\n    ...\n];\n```\n\nYou can also add it as a Facade in `config/app.php`:\n\n```php\n'aliases' =\u003e [\n    ...\n    'Date' =\u003e Jenssegers\\Date\\Date::class,\n    ...\n];\n```\n\n## Languages\n\nThe Date package contains language files for the following languages:\n\n - Albanian\n - Arabic\n - Azerbaijani\n - Bangla\n - Basque\n - Brazilian Portuguese\n - Bulgarian\n - Catalan\n - Croatian\n - Chinese Simplified\n - Chinese Traditional\n - Czech\n - Danish\n - Dutch\n - English\n - Esperanto\n - Estonian\n - Finnish\n - French\n - Galician\n - Georgian\n - German\n - Greek\n - Hebrew\n - Hindi\n - Hungarian\n - Icelandic\n - Indonesian\n - Italian\n - Japanese\n - Kazakh\n - Korean\n - Latvian\n - Lithuanian\n - Macedonian\n - Malay\n - Norwegian\n - Nepali (नेपाली)\n - Polish\n - Portuguese\n - Persian (Farsi)\n - Romanian\n - Russian\n - Thai\n - Serbian (latin)\n - Serbian (cyrillic)\n - Slovak\n - Slovenian\n - Spanish\n - Swedish\n - Turkish\n - Turkmen\n - Ukrainian\n - Uzbek\n - Vietnamese\n - Welsh\n\n## Usage\n\nIn your Eloquent model, add the `EloquentDate` trait:\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass Post extends Model\n{\n    use \\Seiler\\EloquentDate\\EloquentDate;\n\n    /**\n     * The attributes that should be mutated to dates.\n     *\n     * @var array\n     */\n    protected $dates = [\n        'created_at',\n        'updated_at',\n        'published_at',\n    ];\n}\n```\n\nNow, any attribute declared in `$dates` will be converted to `Jenssegers\\Date` instance instead of `Carbon`:\n\n```php\n\\Jenssegers\\Date\\Date::setLocale('fr');\n\n$post = Post::find(1);\n\necho $post-\u003epublished_at-\u003eformat('l j F Y H:i:s'); // samedi 19 mars 2016 21:58:16\n\necho $post-\u003epublished_at-\u003eago(); // il y a 1 jour\n```\n\nTo learn all you can do with `Jenssegers\\Date`, please refer to its own [documentation](https://github.com/jenssegers/date#usage).\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email frederic@seiler.io instead of using the issue tracker.\n\n## Credits\n\n- [Frederic Seiler](https://github.com/fredericseiler) for the trait\n- [Jens Segers](https://github.com/jenssegers/date) for the Date library\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/seiler/eloquent-date.svg?style=flat-square\n[ico-license]: https://img.shields.io/packagist/l/seiler/eloquent-date.svg?style=flat-square\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredericseiler%2Feloquent-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredericseiler%2Feloquent-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredericseiler%2Feloquent-date/lists"}