PHPackages                             bgeneto/ci4-audits - 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. bgeneto/ci4-audits

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

bgeneto/ci4-audits
==================

Simple and lightweight audit logging for CodeIgniter 4

v1.1.5(1y ago)04MITPHPPHP ^7.4 || ^8.0

Since Apr 7Pushed 1y agoCompare

[ Source](https://github.com/bgeneto/ci4-audits)[ Packagist](https://packagist.org/packages/bgeneto/ci4-audits)[ Docs](https://github.com/bgeneto/ci4-audits)[ RSS](/packages/bgeneto-ci4-audits/feed)WikiDiscussions develop Synced 1mo ago

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

ci4-audits
==========

[](#ci4-audits)

Simple and lightweight audit logging for CodeIgniter 4

Quick Start
-----------

[](#quick-start)

1. Install with Composer: `> composer require bgeneto/ci4-audits`
2. Update the database: `> php spark migrate --all`
3. Set up your models:

```
use Bgeneto\Audits\Traits\AuditsTrait;

class JobModel extends Model
{
	use AuditsTrait;

    // Configure event auditing callbacks by using either the class constructor or the model's initialize() method.
    protected function initialize(): void
    {
        parent::initialize();
    	$this->setAuditsCallbacks(['afterInsert', 'afterUpdate', 'afterDelete']);
    }
```

Features
--------

[](#features)

Provides ready-to-use object logging for CodeIgniter 4

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

[](#installation)

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

```
> composer require bgeneto/ci4-audits
```

Or, install manually by downloading the source files and adding the directory to `app/Config/Autoload.php`.

Once the files are downloaded and included in the autoload, run any library migrations to ensure the database is setup correctly:

```
> php spark migrate --all
```

Configuration (optional)
------------------------

[](#configuration-optional)

The library's default behavior can be altered by extending its config file. Copy **examples/Audits.php** to **app/Config/Audits.php** and follow the instructions in the comments. If no config file is found in **app/Config** the library will use its own.

Usage
-----

[](#usage)

Once the library is included all the resources are ready to go and you just need to specify which models and events to audit. Use AuditsTrait to add support to any models you would like tracked:

```
use Bgeneto\Audits\Traits\AuditsTrait;

class JobModel extends Model
{
	use AuditsTrait;
```

Then specify which events you want audited by assigning the corresponding audit methods for those events in the constructor (or `initialize()`):

```
public function __construct()
{
    parent::__construct();
	$this->setAuditsCallbacks(['afterInsert', 'afterUpdate', 'afterDelete']);
}
```

The Audits library will create basic logs of each event in the `audits` table, for example:

idsourcesource\_iduser\_ideventsummarydatacreated\_at10sites279create2 fields: name, phone(NULL)2024-04-05 15:58:4011jobs118update1 fields: description(NULL)2024-04-05 16:01:35If you want to log arbitrary data you can use the `logEvent` static method anywhere in your code:

```
use Bgeneto\Audits\Audits;

$formData = [
    'name'       => 'John Doe'
];

Audits::logEvent($formData, "Profile data changed");
```

The library will record the data (as json) in the `audits` table with the class and method names that called it, for example:

idsourcesource\_iduser\_ideventsummarydatacreated\_at12App\\Controllers\\User\\Profile02updateProfile data changed{"name":"John Doe"}2024-04-06 10:59:0113App\\Controllers\\Login03actionUser Logged in{"user":"Foo Bar","email":""}2024-04-06 11:00:05

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance46

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 64.1% 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

Every ~195 days

Recently: every ~353 days

Total

12

Last Release

442d ago

PHP version history (4 changes)v1.0.0PHP ^7.0

v1.0.4PHP &gt;=7.2

v1.1.0PHP ^7.3 || ^8.0

v1.1.3PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![MGatner](https://avatars.githubusercontent.com/u/17572847?v=4)](https://github.com/MGatner "MGatner (41 commits)")[![bgeneto](https://avatars.githubusercontent.com/u/473074?v=4)](https://github.com/bgeneto "bgeneto (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

loggingeventscodeigniterAuditcodeigniter4

### Embed Badge

![Health badge](/badges/bgeneto-ci4-audits/health.svg)

```
[![Health](https://phpackages.com/badges/bgeneto-ci4-audits/health.svg)](https://phpackages.com/packages/bgeneto-ci4-audits)
```

###  Alternatives

[tatter/audits

Lightweight object logging for CodeIgniter 4

1320.1k3](/packages/tatter-audits)[bedezign/yii2-audit

Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.

201657.4k4](/packages/bedezign-yii2-audit)[muhammadsadeeq/laravel-activitylog-ui

A beautiful, modern UI for Spatie's Activity Log with advanced filtering, analytics, and real-time features.

17510.1k](/packages/muhammadsadeeq-laravel-activitylog-ui)[tatter/outbox

Email toolkit for CodeIgniter 4

178.6k](/packages/tatter-outbox)[cornernote/yii-audit-module

Track and store usage information including page requests, database field changes and system errors.

226.6k](/packages/cornernote-yii-audit-module)

PHPackages © 2026

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