masterro/laravel-chronos

Replace Carbon\Carbon with Cake\Chronos\Chronos

v1.0.0 2018-09-26 08:36 UTC

This package is auto-updated.

Last update: 2024-04-06 08:28:28 UTC


README

68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

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.