PHP code example of heybardi / routersoup

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

    

heybardi / routersoup example snippets


use HeyBardi\RouterSoup\RouterSoup;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        RouterSoup::enable();
    }
}

use HeyBardi\RouterSoup\Enums\RouterSoupRotation;

'rotation' => RouterSoupRotation::LeastUsed,

// app/Providers/RouterSoupServiceProvider.php

protected function gate(): void
{
    Gate::define('viewRouterSoup', function ($user) {
        return in_array($user->email, [
            '[email protected]',
        ]);
    });
}

$schedule->command('routersoup:prune')->daily();

return [
    // URI prefix for the admin panel. Set to null to disable it.
    'path' => env('ROUTERSOUP_PATH', 'routersoup'),

    // Middleware applied to admin panel routes.
    'middleware' => ['web', 'routersoup.auth'],

    // Use a separate DB connection. null = app default.
    'database_connection' => env('ROUTERSOUP_DB', null),

    // Rotation strategy: Random or LeastUsed.
    'rotation' => RouterSoupRotation::Random,

    // Toggle provider usage tracking.
    'analytics' => [
        'enabled' => env('ROUTERSOUP_ANALYTICS', true),
    ],

    // Toggle Laravel AI event monitoring.
    'monitoring' => [
        'enabled' => env('ROUTERSOUP_MONITORING', true),
    ],
];
bash
php artisan routersoup:install
php artisan migrate
bash
php artisan routersoup:prune --hours=72