sp-niemand / yii2-pinba
Pinba for Yii2
Installs: 11 662
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 6
Forks: 2
Open Issues: 0
Requires
- php: >=5.4
Suggests
- misterion/pinba-phpdoc: For IDE hints
This package is not auto-updated.
Last update: 2025-03-01 21:17:06 UTC
README
Description
Installation
Use composer to install:
composer require sp-niemand/yii2-pinba
Usage
Standard
Add the main component and the log target to the config.
'bootstrap' => [/* ... */ 'pinba' /* ... */], 'components' => [ // ... 'pinba' => [ 'class' => \yiiPinba\component\Pinba::className(), ], // ... 'log' => [ 'targets' => [ // ... [ 'class' => \yiiPinba\log\Target::className(), ], // ... ] ] // ... ]
The target handles export of the profile logs to Pinba. Use standard Yii2 method for profiling:
\Yii::beginProfile($token, $category); // ... \Yii::endProfile($token, $category);
Bootstrapping is needed if you want to automatically time actions run.
Low level
Of course, you can use methods from the component directly:
$p = \Yii::$app->get('pinba'); /** @var Pinba $p */ $p->startTimer('timer1'); // ... $p->stopTimer('timer1');