masterro/laravel-chronos

Replace Carbon\Carbon with Cake\Chronos\Chronos
31
Install
composer require masterro/laravel-chronos
Latest Version:v1.0.0
License:MIT
Last Updated:Sep 26, 2018
Links: GitHub  ·  Packagist
Maintainer: MasterRO

Laravel Chronos

Laravel Chronos is a little wrapper for CakePHP/Chronos package with one difference - it uses Laravel's Macroable trait. It also has a Trait for replacing Carbon/Carbon with Chronos for Eloquent models. Chronos is like Carbon but Immutable and Macroable.

Installation

From the command line, run:

composer require masterro/laravel-chronos

Replace Carbon with Chronos

Add ReplaceCarbonWithChronos trait to your base model, or to models you want to use Chronos instead of Carbon. Don't forget add MasterRO\Chronos\ReplaceCarbonWithChronos to use section.

Attention

Dont't confuse MasterRO\Chronos\Chronos with Cake\Chronos\Chronos because MasterRO\Chronos\Chronos is macroable and Cake\Chronos\Chronos is not. MasterRO\Chronos\Chronos implements ChronosContract so you can check and typehint inerface insteadof class name.

Related Packages

andhikamaheva/date

A date library to help you work with dates in different languages

13 1
qwildz/localized-eloquent-date

Multi-language support for Laravel Eloquent's dates

14,443 4
flobbos/laravel-datable

A tiny Laravel package for easily switching localized dates

176 1
jenssegers/date

A date library to help you work with dates in different languages

11,640,583 1,801