PHP code example of onamfc / laravel-route-visualizer
1. Go to this page and download the library: Download onamfc/laravel-route-visualizer 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/ */
onamfc / laravel-route-visualizer example snippets
use onamfc\LaravelRouteVisualizer\Services\RouteScanner;
class YourController extends Controller
{
public function analyzeRoutes(RouteScanner $scanner)
{
// Get all routes with validation
$routes = $scanner->scanRoutes();
// Get routes grouped by controller
$byController = $scanner->getRoutesGroupedByController();
// Get routes grouped by middleware
$byMiddleware = $scanner->getRoutesGroupedByMiddleware();
// Get routes grouped by domain
$byDomain = $scanner->getRoutesGroupedByDomain();
// Get routes grouped by namespace
$byNamespace = $scanner->getRoutesGroupedByNamespace();
// Find duplicate routes
$duplicates = $scanner->findDuplicateRoutes();
// Get hierarchical tree data
$treeData = $scanner->getTreeData();
// Clear cache
$scanner->clearCache();
return response()->json($routes);
}
}
// In your AppServiceProvider
View::composer('route-visualizer::export.html', function ($view) {
$view->with('customData', 'Your custom data');
});
GET /route-visualizer/routes?search=api&method=POST&middleware=auth&domain=api.example.com&namespace=App\Http\Controllers\Api&middleware_group=web&page=1&per_page=50