PHPackages                             albertborsos/historizer - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. albertborsos/historizer

ActiveYii-extension[Logging &amp; Monitoring](/categories/logging)

albertborsos/historizer
=======================

log your model's histories indepently from your model's table structure

08PHP

Since Apr 21Pushed 12y ago1 watchersCompare

[ Source](https://github.com/albertborsos/yii-ar-historizer)[ Packagist](https://packagist.org/packages/albertborsos/historizer)[ RSS](/packages/albertborsos-historizer/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Yii Model Historizer
====================

[](#yii-model-historizer)

Simple extension to log your models change history. Independent from your models table structure, because it stores the attributes in one field in JSON format.

Installation steps
==================

[](#installation-steps)

1.) Via composer:

```
    "require":{
        "albertborsos/historizer": "dev-master",
    }

```

2.) Create the table for the histories by the initialize schema in `datas` folder

3.) Then, add this line to your protected/config/main.php

```
    'import' => array(
        'application.vendor.albertborsos.historizer',
    ),

```

How To Use
==========

[](#how-to-use)

In your model's class modify the `beforeSave()` and `beforeDelete()` methods If the new attributes are different from the old one, it saves the old model's attributes automatically. If save happened the historize() methods return value is true, else false.

```
public function beforeSave(){
        if (parent::beforeSave()){
            if (!$this->isNewRecord){
               if (AHistorizer::historize($this)){
                   // if attributes are modified, update fields
                   $this->date_update = date('Y-m-d H:i:s');
                   $this->user_update = Yii::app()->user->id;
               }
            }else{
               $this->user_create = Yii::app()->user->id;
               $this->date_create = date('Y-m-d H:i:s');
            }
            return true;
        }else{
            return false;
        }
    }

    public function beforeDelete() {
        if (parent::beforeDelete()){
            AHistorizer::historize($this);
            return true;
        }else{
            return false;
        }
    }

```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f3f22774bd72617f621ad89b1b6d7421f837ea8ff2521e4d472df98744dca7cf?d=identicon)[albertborsos](/maintainers/albertborsos)

### Embed Badge

![Health badge](/badges/albertborsos-historizer/health.svg)

```
[![Health](https://phpackages.com/badges/albertborsos-historizer/health.svg)](https://phpackages.com/packages/albertborsos-historizer)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
