PHP code example of apextoolbox / laravel-logger

1. Go to this page and download the library: Download apextoolbox/laravel-logger 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/ */

    

apextoolbox / laravel-logger example snippets


'channels' => [
    // ... other channels

    'apextoolbox' => [
        'driver' => 'monolog',
        'handler' => \ApexToolbox\Logger\Handlers\ApexToolboxLogHandler::class,
        'level' => 'debug',
    ],
],

// bootstrap/app.php (Laravel 11+)
->withMiddleware(function (Middleware $middleware) {
    $middleware->append(\ApexToolbox\Logger\Middleware\LoggerMiddleware::class);
})

// Or app/Http/Kernel.php (Laravel 10)
protected $middleware = [
    \ApexToolbox\Logger\Middleware\LoggerMiddleware::class,
];

return [
    'enabled' => env('APEXTOOLBOX_ENABLED', true),
    'token' => env('APEXTOOLBOX_TOKEN', ''),

    // Paths to /health', 'api/ping'],
    ],

    // Headers filtering
    // 'exclude' removes headers entirely, 'mask' replaces values with '*******'
    'headers' => [
        'exclude' => [
            'authorization', 'x-api-key', 'cookie', 'x-auth-token',
            'x-access-token', 'x-refresh-token', 'bearer', 'x-secret',
            'x-private-key', 'authentication',
        ],
        'mask' => [
            'ssn', 'social_security', 'phone', 'email',
            'address', 'postal_code', 'zip_code',
        ],
    ],

    // Request body filtering
    // 'exclude' removes fields entirely, 'mask' replaces values with '*******'
    'body' => [
        'exclude' => [
            'password', 'password_confirmation', 'token', 'access_token',
            'refresh_token', 'api_key', 'secret', 'private_key', 'auth',
            'authorization', 'social_security', 'credit_card', 'card_number',
            'cvv', 'pin', 'otp',
        ],
        'mask' => [
            'ssn', 'social_security', 'phone', 'email',
            'address', 'postal_code', 'zip_code',
        ],
    ],

    // Response body filtering
    // 'exclude' removes fields entirely, 'mask' replaces values with '*******'
    'response' => [
        'exclude' => [
            'password', 'password_confirmation', 'token', 'access_token',
            'refresh_token', 'api_key', 'secret', 'private_key', 'auth',
            'authorization', 'social_security', 'credit_card', 'card_number',
            'cvv', 'pin', 'otp',
        ],
        'mask' => [
            'ssn', 'social_security', 'phone', 'email',
            'address', 'postal_code', 'zip_code',
        ],
    ],
];
bash
php artisan vendor:publish --tag=logger-config