PHP code example of phattarachai / ops-laravel

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

    

phattarachai / ops-laravel example snippets


Ops::auth(fn (Request $request) => $request->user()?->isAdmin() ?? false);

Ops::segmentUsing(fn (User $user) => $user->role->value);          // the "segment" requests are split by
Ops::outgoingEndpointUsing(fn ($request) => 'vendor.orders');       // name outgoing calls (default: host)
Ops::resolveUsersUsing(fn (array $ids) => [...]);                   // id => ['name' => …, 'detail' => …, 'url' => …]
Ops::overviewBlocks(fn (TimeRange $range) => [...]);                // extra Overview status blocks
Ops::jobRunLinksUsing(fn (array $uuids) => [...]);                  // run uuid => [['label' => …, 'url' => …]] in a job's Latest runs
Ops::navLinks([['label' => 'Horizon', 'url' => url('horizon')]]);   // extra sidebar links
Ops::withoutRecording(fn () => ...);                                // skip telemetry for a block
bash
composer migrate
php artisan ops:install      # config, the Ops page stub, @ops Vite alias, Tailwind wiring, default alert rules
npm run build