taufiqrahman/yii2-apirestlog

Description

Installs: 2 811

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.1.0 2018-07-31 15:06 UTC

This package is not auto-updated.

Last update: 2025-04-13 08:31:22 UTC


README

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']],
......