PHP code example of 401clicks / laravel-logger

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

    

401clicks / laravel-logger example snippets


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

    'clicks' => [
        'driver' => 'clicks',
        'url' => env('CLICKS_LOG_URL', 'https://logs.401clicks.com/api/v1/logs'),
        'token' => env('CLICKS_API_TOKEN'),
        'level' => env('CLICKS_LOG_LEVEL', 'debug'),
    ],
],

use Illuminate\Support\Facades\Log;

Log::info('User logged in', ['user_id' => $user->id]);
Log::error('Payment failed', ['order_id' => $order->id, 'error' => $e->getMessage()]);

'masking' => [
    'custom_patterns' => [
        [
            'name' => 'Customer IDs',
            'pattern' => '/CUST-[A-Z0-9]{8}/i',
            'replacement' => '[CUSTOMER_ID]',
        ],
        [
            'name' => 'Internal Order Numbers',
            'pattern' => '/ORD-\d{10}/',
            'replacement' => '[ORDER_ID]',
        ],
    ],
],

'masking' => [
    'patterns' => [
        'credit_cards',
        'ssn',
        'api_keys',
        'passwords',
        'phone_numbers',
        'emails',       // Now enabled
        'ip_addresses', // Now enabled
    ],
],
bash
php artisan vendor:publish --tag=clicks-logger-config