PHP code example of dockcodes / dock-ray-laravel

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

    

dockcodes / dock-ray-laravel example snippets


use Dock\Ray\Laravel\Ray;

->withExceptions(function (Illuminate\Foundation\Configuration\Exceptions $exceptions) {
    $exceptions->reportable(fn (Throwable $e) => Ray::report($e));
})

public function register(): void
{
    $this->reportable(fn (Throwable $e) => Ray::report($e));
}

public function report(Throwable $exception)
{
    Ray::report($exception);

    parent::report($exception);
}

Ray::message('Nightly import finished late', \Dock\Ray\Severity::warning());

use Dock\Ray\Laravel\Http\Middleware\TrackTransaction;
use Illuminate\Foundation\Configuration\Middleware;

->withMiddleware(function (Middleware $middleware) {
    $middleware->appendToGroup('web', TrackTransaction::class);
    // Optional, for ordinary application APIs:
    // $middleware->appendToGroup('api', TrackTransaction::class);
})

protected $middlewareGroups = [
    'web' => [
        // Existing middleware...
        \Dock\Ray\Laravel\Http\Middleware\TrackTransaction::class,
    ],
];

'ignore_transactions' => ['horizon*', 'telescope*', '_debugbar*', 'health*'],

use Dock\Ray\Laravel\Events\TransactionStarting;
use Illuminate\Support\Facades\Event;

Event::listen(TransactionStarting::class, function (TransactionStarting $event) {
    // DockRay panel-specific service; not 

Ray::setUser(['id' => $account->id, 'username' => $account->slug]);

'inventory' => [
    'enabled' => (bool) env('RAY_INVENTORY', false),
    'site_url' => env('RAY_INVENTORY_SITE_URL'),
    'exclude_packages' => ['company/*'],
],
shell
php artisan config:cache
shell
php artisan ray:inventory --force