PHPackages                             imo-tikuwa/cakephp-operation-logs - 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. imo-tikuwa/cakephp-operation-logs

ActiveCakephp-plugin[Logging &amp; Monitoring](/categories/logging)

imo-tikuwa/cakephp-operation-logs
=================================

OperationLogs plugin for CakePHP

v2.1.0(4y ago)0309MITPHPPHP &gt;=8.0

Since Feb 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/imo-tikuwa/cakephp-operation-logs)[ Packagist](https://packagist.org/packages/imo-tikuwa/cakephp-operation-logs)[ RSS](/packages/imo-tikuwa-cakephp-operation-logs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (21)Used By (0)

OperationLogs plugin for CakePHP 3 and 4
========================================

[](#operationlogs-plugin-for-cakephp-3-and-4)

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).

The recommended way to install composer packages is:

```
# for CakePHP4
composer require imo-tikuwa/cakephp-operation-logs "2.*"

# for CakePHP3
composer require imo-tikuwa/cakephp-operation-logs "1.*"

```

How to Use
----------

[](#how-to-use)

Load plugin to bootstrap.php

```
// cakephp 3.6 or less
Plugin::load('OperationLogs', ['bootstrap' => true]);

// cakephp 3.7 or higher
Application::addPlugin('OperationLogs', ['bootstrap' => true]);

```

or Application.php

```
    public function bootstrap(): void
    {
        parent::bootstrap();

+        $this->addPlugin('OperationLogs', ['bootstrap' => true]);
    }
```

Execute the database table initialization command.
※Executing the command will delete &amp; create operation\_logs, operation\_logs\_hourly, operation\_logs\_daily, operation\_logs\_monthly tables.
※If you want to record up to microseconds, specify the `--enable_micro` option.

```
cake init_operation_logs

```

Append middleware to Application.php

```
use OperationLogs\Middleware\OperationLogsMiddleware;

    public function middleware($middlewareQueue)
    {
        $middlewareQueue
            // Add operation_logs middleware.
            ->add(new OperationLogsMiddleware([
                'exclude_urls' => [
                    '/debug-kit',
                    '/admin'
                ]
            ]))
            ;
        return $middlewareQueue;
    }

```

※If you want to log all requests without using the option, please replace with `OperationLogsSimpleMiddleware` middleware.

```
use OperationLogs\Middleware\OperationLogsSimpleMiddleware;

    public function middleware($middlewareQueue)
    {
        $middlewareQueue
            // Add operation_logs middleware.
            ->add(new OperationLogsSimpleMiddleware())
            ;
        return $middlewareQueue;
    }

```

Options.
--------

[](#options)

option nameoption typedefaultexamplememomodestring'exclude''include'Only 'exclude' and 'include' allowedexclude\_urlsstring array\[ '/debug-kit' \]\[ '/debug-kit', '/admin' \]Exclude with prefix matchexclude\_ipsstring array\[\]\[ '192.168', '::' \]Exclude with prefix matchexclude\_user\_agentsstring array\[\]\[ 'Safari', 'Edge' \]Exclude with broad matchinclude\_urlsstring array\[\]\[ '/admin/top' \]Include with prefix matchinclude\_ipsstring array\[\]\[ '192.168.1.3' \]Include with prefix matchinclude\_user\_agentsstring array\[\]\[ 'Firefox', 'Chrome' \]Include with broad match※If 'mode' is 'exclude' the 'include\_〇〇' option is ignored. (And vice versa)

CakePHP4.3以上のバージョンでPHPUnitテストを実施する場合
------------------------------------

[](#cakephp43以上のバージョンでphpunitテストを実施する場合)

CakePHP4.3で実施されたFixtureのアップグレードに伴い、PHPUnitテストの際にスキーマファイルをロードする必要があります。
以下のような操作でOperationLogsプラグイン内に同梱するスキーマファイルをアプリケーション本体のschemaディレクトリにコピーすることができます。

```
composer require imo-tikuwa/cakephp-operation-logs "2.*"
composer run-script post-install-cmd --working-dir=vendor\imo-tikuwa\cakephp-operation-logs

```

Data summary commands.
----------------------

[](#data-summary-commands)

daily\_summaryコマンド、monthly\_summaryコマンド、hourly\_summaryコマンドがあります。
operation\_logsテーブルのデータを元にクライアントIP、ユーザーエージェント、リクエストURLなどでグルーピングしたデータを集計します。

### daily\_summary command.

[](#daily_summary-command)

\--target\_ymdオプションで集計日を設定可能。
未指定のときは前日のデータを集計します。
データはoperation\_logs\_dailyテーブルに記録されます。

```
cake daily_summary --target_ymd=2020-02-13

```

### monthly\_summary command.

[](#monthly_summary-command)

\--target\_ymオプションで集計年月を6桁の数字で設定可能。
未指定の時は先月のデータを集計します。
データはoperation\_logs\_monthlyテーブルに記録されます。

```
cake monthly_summary --target_ym=202002

```

### hourly\_summary command.

[](#hourly_summary-command)

\--target\_ymdオプションで集計日を設定可能。
未指定の時は前日のデータを集計します。
1時間単位でデータを集計します。
データはoperation\_logs\_hourlyテーブルに記録されます。

```
cake hourly_summary --target_ymd=2020-02-13

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 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

Every ~38 days

Recently: every ~58 days

Total

17

Last Release

1651d ago

Major Versions

v0.2.1 → v2.0.02020-10-10

v1.0.0 → 3.x-dev2020-10-10

PHP version history (2 changes)v2.0.4PHP &gt;=7.2

v2.0.5PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/03ffdd79ec95f91c916b789ff16fc94e60bd8a53bdd2a4cd64a79963c9878c6b?d=identicon)[imo-tikuwa](/maintainers/imo-tikuwa)

---

Top Contributors

[![imo-tikuwa](https://avatars.githubusercontent.com/u/48991931?v=4)](https://github.com/imo-tikuwa "imo-tikuwa (57 commits)")

### Embed Badge

![Health badge](/badges/imo-tikuwa-cakephp-operation-logs/health.svg)

```
[![Health](https://phpackages.com/badges/imo-tikuwa-cakephp-operation-logs/health.svg)](https://phpackages.com/packages/imo-tikuwa-cakephp-operation-logs)
```

###  Alternatives

[lordsimal/cakephp-sentry

Sentry plugin for CakePHP

12270.3k](/packages/lordsimal-cakephp-sentry)

PHPackages © 2026

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