PHP code example of laraflow / backpack-api-log

1. Go to this page and download the library: Download laraflow/backpack-api-log library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laraflow / backpack-api-log example snippets


return [
    'table' => 'api_logs',
    'model' => \Laraflow\BackpackApiLog\Models\BackpackApiLog::class,
    'route' => 'api-log',
    'enabled' => env('BACKPACK_API_LOG', false),
    'logs' => [
        //which methods should be logged
        'method' => [
            'GET' => 'GET',
            'POST' => 'POST',
            'PUT' => 'PUT',
            'PATCH' => 'PATCH',
            'DELETE' => 'DELETE',
            'OPTION' => 'OPTION',
        ],
        //which api endpoints should be logged
        'host' => [
            //
        ],
        //which api http status code should be logged
        'code' => [
            '200' => '200',
            '400' => '400',
            '500' => '500',
            '404' => '404',
            '422' => '422',
            '419' => '419',
        ],
    ],
];
bash
php artisan backpack-api-log:install
php artisan migrate
bash
php artisan vendor:publish --tag="api-log-config"
php artisan vendor:publish --tag="api-log-migration"