Skip to content

Automatic create log for request, response, controller dan action

License

Notifications You must be signed in to change notification settings

taufiqrahman/yii2-apirestlog

Repository files navigation

Api Restful Log

Automatic create log for request, response, controller dan action

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist taufiqrahman/yii2-apirestlog "*"

or add

"taufiqrahman/yii2-apirestlog": "*"

to the require section of your composer.json file.

Database Migration

Check your database settings and run migration from your console:

php yii migrate --migrationPath=@vendor/taufiqrahman/yii2-apirestlog/migrations

For more informations see Database Migration Documentation

Usage

Once the extension is installed, simply use it in your code by :

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:

......
'modules' => [
    'rahman'=>[
                'class'=>'rahmansoft\apirestlog\Module',
            ],
],
......

Add the new menu item to your navbar:

......
['label' => 'Log', 'url' => ['/rahman/wslog']],
......

About

Automatic create log for request, response, controller dan action

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages