Swap out Carbon for Chronos

2.0.0 2018-12-20 01:42 UTC

This package is auto-updated.

Last update: 2021-04-29 19:39:10 UTC


Latest Stable Version Total Downloads Build Status Coverage Status

This is a custom package designed for Laravel Eloquent. It provides a trait that can be used in model classes that will cast datetime fields to ChronosInterface instead of Carbon instances.

Chronos is a drop-in replacement for Carbon but is immutable by default. It also provides an interface that can be used for some genericising as well.

See the Chronos documentation for more information.


To convert datetime casts from Carbon instances to Chronos instances in an Eloquent model, all you need to do is use this trait in the model. An example is shown below:

use HealthEngine\LaravelChronos\ChronosTimestamps;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
    use ChronosTimestamps;

    protected $dates = [

    protected $casts = [
        'processed_at' => 'datetime',


Laravel Chronos is licensed under the MIT license.