Prior to installing this package, ensure that you have already installed Cappadocia Viewer
You can install the package via composer:
composer require hsndmr/cappadocia-viewer-for-laravel --dev
You can publish the config file with:
php artisan vendor:publish --tag="cappadocia-viewer"
This is the contents of the published config file:
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),
];
You can show queries by using cappadocia
helper function.
cappadocia()->watchQueries();
User::latest()->first();
cappadocia()->stopWatchingQueries();
// This query will not be shown in the viewer
User::first()->first();
If you want to show all queries, you can add CAPPADOCIA_VIEWER_WATCH_QUERIES=true
to your .env file.
You can show jobs by using cappadocia
helper function.
cappadocia()->watchJobs();
CappadociaViewerJob::dispatchSync('viewer');
cappadocia()->stopWatchingJobs();
// This job will not be shown in the viewer
CappadociaViewerJob::dispatchSync('another viewer');
If you are utilizing Laravel Horizon, you can insert CAPPADOCIA_VIEWER_WATCH_JOBS=true
into your .env file. This will enable you to view all jobs in the viewer
CappadociaViewerJob::dispatch('viewer');
Logs are shown by default. If you want to disable it, you can add CAPPADOCIA_VIEWER_WATCH_LOGS=false
to your .env file.
Log::info('This log will be shown in the viewer');
If you want to show requests, you can add CAPPADOCIA_VIEWER_WATCH_REQUESTS=true
to your .env file. After that, you can see all requests in the viewer.
If you want to show custom messages, you can use cappadocia
helper function.
cappadocia('This is custom message')
->send([
'custom' => 'data',
]);
cappadocia('This is custom message with Badge')
->setBadge('Badge')
->send([
'custom' => 'data',
]);
To disable the Cappadocia Viewer, you can include CAPPADOCIA_VIEWER_ENABLED=false
in your .env file. This could be particularly useful if you wish to disable it within a testing environment.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.