MasterRO94 / laravel-chronos by MasterRO

Replace Carbon\Carbon with Cake\Chronos\Chronos
27
0
2
Package Data
Maintainer Username: MasterRO
Maintainer Contact: igoshin18@gmail.com (Roman Ihoshyn)
Package Create Date: 2017-08-11
Package Last Update: 2018-09-26
Language: PHP
License: MIT
Last Refreshed: 2024-11-24 03:01:00
Package Statistics
Total Downloads: 27
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

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.