PHP code example of hsndmr / cappadocia-viewer-for-laravel

1. Go to this page and download the library: Download hsndmr/cappadocia-viewer-for-laravel 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/ */

    

hsndmr / cappadocia-viewer-for-laravel example snippets


return [
    'server_url'    => env('CAPPADOCIA_VIEWER_SERVER_URL', 'http://127.0.0.1:9091'),
    'timeout'       => env('CAPPADOCIA_VIEWER_TIMEOUT', 3),
    'enabled'       => env('CAPPADOCIA_VIEWER_ENABLED', true),
    'watch_logs'    => env('CAPPADOCIA_VIEWER_WATCH_LOGS', true),
    'watch_jobs'    => env('CAPPADOCIA_VIEWER_WATCH_JOBS', false),
    'watch_queries' => env('CAPPADOCIA_VIEWER_WATCH_QUERIES', false),
];

    cappadocia()->watchQueries();
    User::latest()->first();
    cappadocia()->stopWatchingQueries();
    
    // This query will not be shown in the viewer
    User::first()->first();
bash
php artisan vendor:publish --tag="cappadocia-viewer"
` php
cappadocia()->watchJobs();
CappadociaViewerJob::dispatchSync('viewer');
cappadocia()->stopWatchingJobs();

// This job will not be shown in the viewer
CappadociaViewerJob::dispatchSync('another viewer');
` php
CappadociaViewerJob::dispatch('viewer');
` php
cappadocia('This is custom message')
    ->send([
        'custom' => 'data',
    ]);

cappadocia('This is custom message with Badge')
    ->setBadge('Badge')
    ->send([
        'custom' => 'data',
    ]);