PHP code example of khodja / laravel-observer

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

    

khodja / laravel-observer example snippets


use Khodja\LaravelObserver\Logging\ObserverHandler;

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['daily', 'observer'],
        'ignore_exceptions' => false,
    ],

    'observer' => [
        'driver' => 'monolog',
        'handler' => ObserverHandler::class,
        'level' => env('OBSERVER_LEVEL', 'debug'),
    ],

    // Keep the standard daily channel configured here.
],

Log::info('Order created', ['order_id' => $order->id]);
Log::error('Order sync failed', ['order_id' => $order->id]);