PHPackages                             perfbase/cakephp - 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. perfbase/cakephp

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

perfbase/cakephp
================

CakePHP integration for the Perfbase APM platform.

v1.1.2(4w ago)12↓100%Apache-2.0PHPPHP &gt;=7.4 &lt;8.6CI passing

Since Apr 8Pushed 4w agoCompare

[ Source](https://github.com/perfbaseorg/cakephp)[ Packagist](https://packagist.org/packages/perfbase/cakephp)[ Docs](https://github.com/perfbaseorg/cakephp)[ RSS](/packages/perfbase-cakephp/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

 [ ![Perfbase](https://camo.githubusercontent.com/a4e071fd1246cf5c68819015801139400d74b208b76a07ba8c5945d6e4ffd3ba/68747470733a2f2f63646e2e70657266626173652e636f6d2f696d672f6c6f676f2d66756c6c2e737667) ](https://perfbase.com)

### Perfbase for CakePHP

[](#perfbase-for-cakephp)

 CakePHP integration for [Perfbase](https://perfbase.com).

 [![Packagist Version](https://camo.githubusercontent.com/9c1107d5c6e819f5597cc320bd6996be20d67bf54389c6b4da0cefa123439539/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70657266626173652f63616b65706870)](https://packagist.org/packages/perfbase/cakephp) [![License](https://camo.githubusercontent.com/1c1aee5c3ad538dbe5d5da18690565bb114929e7b2063ff14196c9a5948a1b6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70657266626173652f63616b65706870)](https://github.com/perfbaseorg/cakephp/blob/main/LICENSE.txt) [![CI](https://camo.githubusercontent.com/82cd61f75d9517d4d5bf2451f76cd4deabc1fd699df81ed8e6fec4166bae1bd3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70657266626173656f72672f63616b657068702f63692e796d6c3f6272616e63683d6d61696e)](https://github.com/perfbaseorg/cakephp/actions/workflows/ci.yml) [![PHP Version](https://camo.githubusercontent.com/1150142271e92a6b30ce3ef37f5548f25d15d1e9cd200eea972f746cc7a2c40a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e342532422d626c7565)](https://camo.githubusercontent.com/1150142271e92a6b30ce3ef37f5548f25d15d1e9cd200eea972f746cc7a2c40a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e342532422d626c7565) [![CakePHP Version](https://camo.githubusercontent.com/c204803fb25af79dff8a06973254d9462331fbbb4bb78f41e639bb2ab0253be3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63616b657068702d342e342d2d352e782d626c7565)](https://camo.githubusercontent.com/c204803fb25af79dff8a06973254d9462331fbbb4bb78f41e639bb2ab0253be3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63616b657068702d342e342d2d352e782d626c7565)

This package is a thin adapter over [`perfbase/php-sdk`](https://packagist.org/packages/perfbase/php-sdk). It wires CakePHP HTTP requests and command lifecycles into the shared SDK and leaves transport, payload construction, extension handling, and submission to `perfbase/php-sdk`.

What it profiles
----------------

[](#what-it-profiles)

- HTTP requests on CakePHP `4.4+` and `5.x`
- CakePHP 5 console commands through command lifecycle events
- CakePHP 4 console commands when they extend `ProfiledCommand`

Out of scope in `v1`:

- Queue profiling
- Custom buffering, retry, or transport logic

Requirements
------------

[](#requirements)

- PHP `7.4` to `8.5`
- CakePHP `^4.4 || ^5.0`
- `ext-json`
- `perfbase/php-sdk ^1.0`
- The native Perfbase PHP extension in the host runtime if you want traces to be collected

The package fails open when the extension is unavailable. Your CakePHP application keeps running, but no Perfbase trace data is collected until the extension is installed and loaded.

If your application wants manual custom spans outside the automatic HTTP and console integration, depend on and use [`perfbase/php-sdk`](https://packagist.org/packages/perfbase/php-sdk) directly. This package does not add a separate Cake-specific manual tracing API.

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

[](#installation)

Install the package from Packagist:

```
composer require perfbase/cakephp:^1.0
```

Install the Perfbase PHP extension if it is not already available:

```
bash -c "$(curl -fsSL https://cdn.perfbase.com/install.sh)"
```

Restart PHP-FPM, RoadRunner workers, Swoole workers, or your web server after installing the extension.

Load the plugin in your application:

```
use Cake\Http\BaseApplication;
use Perfbase\CakePHP\PerfbasePlugin;

class Application extends BaseApplication
{
    public function bootstrap(): void
    {
        parent::bootstrap();

        $this->addPlugin(PerfbasePlugin::class);
    }
}
```

Once the plugin is loaded:

- HTTP profiling is enabled automatically through plugin middleware
- CakePHP 5 command profiling is enabled automatically through command events
- CakePHP 4 command profiling is available by extending `ProfiledCommand`

CakePHP 4 does not get automatic command profiling. That path is CakePHP 5 only.

Quick start
-----------

[](#quick-start)

Create `config/perfbase.php` in your application:

```
