PHP code example of phattarachai / watchtower-laravel

1. Go to this page and download the library: Download phattarachai/watchtower-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 / watchtower-laravel example snippets


use Phattarachai\WatchtowerLaravel\Watchtower;

Watchtower::auth(fn ($request): bool => $request->user()?->isAdmin() === true);

$panel->renderHook(
    PanelsRenderHook::HEAD_END,
    fn (): string => Blade::render('@watchtowerUser'),
);

// config/horizon.php → 'defaults' (and list it under each environment)
'app-supervisor-watchtower' => [
    'connection' => 'redis',
    'queue' => ['watchtower'],
    'maxProcesses' => 1,
    'tries' => 3,
    'timeout' => 60,
],

  Watchtower::recordReplaysWhen(fn (Request $request): bool => ! $request->routeIs('checkout.*', 'consent.*'));
  

'before_send' => [
    // …
    'scrub_url_patterns' => [
        '#/feeds/\K[^/?]+#', // /feeds/s3cr3t/orders.csv → /feeds/[Filtered]/orders.csv
    ],
],
bash
php artisan watchtower:doctor
bash
php artisan watchtower:install --dsn=https://{public_key}@watchtower.example.com/42
php artisan watchtower:install --mode=dual --dsn=https://{public_key}@watchtower.example.com/42
bash
composer update phattarachai/watchtower-laravel
php artisan vendor:publish --tag=watchtower-inertia --force
php artisan watchtower:doctor