PHPackages                             dual/kronikl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dual/kronikl

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dual/kronikl
============

A model history tracking library for Laravel.

v1.0.2(1y ago)015MITPHP

Since Sep 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dualph/kronikl)[ Packagist](https://packagist.org/packages/dual/kronikl)[ RSS](/packages/dual-kronikl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Kronikl
=======

[](#kronikl)

A model history tracking library for Laravel.

Installation
------------

[](#installation)

Install the package via composer:

```
composer require dual/kronikl
```

This will include Kronikl in your project. Now, publish the configuration file and the migration file:

```
php artisan vendor:publish --provider="Dual\Kronikl\KroniklServiceProvider"
```

Finally, run the migration:

> NOTE: If you are using UUID primary keys, replace instances of `unsignedBigInteger` with `uuid` before migrating.

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

By default, `create`, `update`, `delete` and `restore` operations performed via Eloquent are observed. This means you do not need to call any other function, simply include the models you want to watch in the `models` key in the configuration file (`config/kronikl.php`).

Options are documented in `config/kronikl.php` and are provided with sane defaults. Feel free to modify as needed.

By default, `password` is defined in the `discards` key for security purposes. Please do not remove this unless you know what you're doing.

Records
-------

[](#records)

Audit trail records are saved in the `kronikl_logs` table and is automatically created upon every successful `created`, `updated` and `deleted` event monitored by an observer. Records are stored in JSON and can be searched via fuzzy search (using `LIKE` direct in the `record` column), or by using Laravel's [`whereJsonContains()`](https://laravel.com/docs/11.x/queries#json-where-clauses) method for more specific results.

### What does it look like?

[](#what-does-it-look-like)

The actual record is stored as JSON, so it's easy to do a `json_decode()` on the record and call whatever record you want to use. For example:

```
