PHP code example of dutchcodingcompany / laravel-compact-route-list

1. Go to this page and download the library: Download dutchcodingcompany/laravel-compact-route-list 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/ */

    

dutchcodingcompany / laravel-compact-route-list example snippets


// adds php artisan route:compact-list --api
CompactRouteList::addFilter('api'); // adds ['api' => 'api] to filters

// adds php artisan route:compact-list --api
// adds php artisan route:compact-list --api-v2
CompactRouteList::addFilters([
    'api',
    'old-api' => ['api/v1', 'api/v2'],
]);

// adds php artisan route:compact-list --api-v1
CompactRouteList::setFilters([
    'api-v1' => 'api/v1',
]); // removes all existing filters and only uses new filters

// this is the default callback
CompactRouteList::setFilterCallback(static function (array $route, $filter): bool {
    return \Illuminate\Support\Str::contains($route['uri'], $filter);
});