Api Restful Log
Automatic create log for request, response, controller dan action, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist taufiqrahman/yii2-apirestlog "*"
or add, (*4)
"taufiqrahman/yii2-apirestlog": "*"
to the require section of your composer.json
file., (*5)
Database Migration
Check your database settings and run migration from your console:, (*6)
php yii migrate --migrationPath=@vendor/taufiqrahman/yii2-apirestlog/migrations
For more informations see Database Migration Documentation, (*7)
Usage
Once the extension is installed, simply use it in your code by :, (*8)
use Rahmansoft\Apirestlog\restlog;
class SomeController extends Controller
{
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['restlog']=
[
'class' => restlog::class,
'LOG_ON_ERROR'=> true // get all error response, false value to disable error message in your log DB
];
return $behaviors;
}
To access the module, you need to add this to your application configuration:, (*9)
......
'modules' => [
'rahman'=>[
'class'=>'rahmansoft\apirestlog\Module',
],
],
......
Add the new menu item to your navbar:, (*10)
......
['label' => 'Log', 'url' => ['/rahman/wslog']],
......