PHPackages                             nlt\_codilog/database-change-log\_fork - 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. [Database &amp; ORM](/categories/database)
4. /
5. nlt\_codilog/database-change-log\_fork

ActiveLibrary[Database &amp; ORM](/categories/database)

nlt\_codilog/database-change-log\_fork
======================================

A PHP class to log all changes of table data from raw SQL or with PDO statement

V1.0.0(4y ago)0161MITPHPPHP &gt;=5.3

Since Oct 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nltCodilog/database-change-log_fork)[ Packagist](https://packagist.org/packages/nlt_codilog/database-change-log_fork)[ RSS](/packages/nlt-codilog-database-change-log-fork/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Universal database log of data changes by parse the sql queries for PHP
=======================================================================

[](#universal-database-log-of-data-changes-by-parse-the-sql-queries-for-php)

Note: This repository is a fork of

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

[](#installation)

\###Download [From Git](https://github.com/moledet/database-change-log)
\###Clone

```
git clone https://github.com/nltCodilog/database-change-log_fork.git
```

\###Composer

```
php composer.phar require nlt_codilog/database-change-log_fork
```

or add to yours *composer.json* see [the documentation](https://getcomposer.org/doc/).

```
 {
     "repositories": [
         {
             "url": "https://github.com/nltCodilog/database-change-log_fork.git",
             "type": "git"
         }
     ],
     "require": {
         "nltCodilog/database-change-log": "main"
     }
 }
```

\###Dependency This class depends on [PHP-SQL-Parser](https://github.com/greenlion/PHP-SQL-Parser).

Usage
-----

[](#usage)

\###Config You must config a database connection.

```
 $config = array(
    'database'=>'mysql',
    'host'=>'localhost',
    'port'=>3306,
    'dbname'=>'test',
    'charset'=>'utf8',
    'user'=>'admin',
    'password'=>'secret'
 );

 DatabaseChangeLog::getInstance()->setConnection($config);
```

May config current user id (default 0), system name(default CRM) or list of tables|columns|actions that need log. If not config the tables list - all tables changes will be logged.

```
DatabaseChangeLog::getInstance()->setUserId(7);
DatabaseChangeLog::getInstance()->setSystemName('API');

$config = [
                    'user'=>[
                        'insert'=>['login','name','password']
                        'delete'=>'all',
                        'update'=>['login','name']
                     ],
                     'customers'=>'all',
           ];

DatabaseChangeLog::getInstance()->setLogTablesConfig($config);
```

\###How to use Need put call of log sql before run. You may override framework or ORM connection to run it before query.

```
 $sql = "UPDATE user SET password='secret' WHERE id=7;";
 DatabaseChangeLog::getInstance()->log($sql);

 $framework->getConnection()->runSQL($sql);
```

Or PDO:

```
 $query = 'UPDATE users SET bonus = bonus + ? WHERE id = ?';
 $stmt = $pdo->prepare($query);
 foreach ($data as $id => $bonus)
 {
    DatabaseChangeLog::getInstance()->log($query,[$bonus,$id]);
    $stmt->execute([$bonus,$id]);
 }
```

\###Result In table *data\_change\_log* will be save the log of changes.

idactiontablecolumnnewValueoldValuedatesystemuserIdipUserAgentcolumnReferenceoperatorReferencevalueReference1updatecustomersphone77777999992017-02-02 10:33:32CRM5127.0.0.1Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36id=2894602deletecountrynullnull2017-02-03 11:33:22API1127.1.1.7Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36countryId=203insertusernameBobnull2017-02-04 15:31:52API1127.1.1.7Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36nullnullnull5insertuserphone89898null2017-02-04 15:31:52API1127.1.1.7Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36nullnullnull6insertuserpasswordsecretnull2017-02-04 15:31:52API1127.1.1.7Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36nullnullnull

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1672d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/568212ea66cf94fe296ee141edf17f2f993aa77c9df3b8c7b226c74de9a11dfc?d=identicon)[nltCodilog](/maintainers/nltCodilog)

---

Top Contributors

[![nltCodilog](https://avatars.githubusercontent.com/u/92816930?v=4)](https://github.com/nltCodilog "nltCodilog (5 commits)")

---

Tags

logphpdatabasesqltablecolumn

### Embed Badge

![Health badge](/badges/nlt-codilog-database-change-log-fork/health.svg)

```
[![Health](https://phpackages.com/badges/nlt-codilog-database-change-log-fork/health.svg)](https://phpackages.com/packages/nlt-codilog-database-change-log-fork)
```

###  Alternatives

[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[druidfi/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

35489.8k6](/packages/druidfi-mysqldump-php)[butschster/dbml-parser

DBML (database markup language) parser written on PHP8.

6416.8k2](/packages/butschster-dbml-parser)[calebdw/laravel-sql-entities

Manage SQL entities in Laravel with ease.

301.3k](/packages/calebdw-laravel-sql-entities)

PHPackages © 2026

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