Displaying registered routes in Laravel
Console command:
php artisan routes (laravel 4)
php artisan route:list (laravel 5)
+--------+----------------------------------------------------+-----------------------+----------------------------------------------+--------------------------------------------------------------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------+----------------------------------------------------+-----------------------+----------------------------------------------+--------------------------------------------------------------------+---------------+
| | GET /admin/configuration | | ConfigurationController@index | auth, keyMaster:configuration | |
| | POST /admin/configuration | | ConfigurationController@update | auth, keyMaster:configuration | |
| | GET /admin/logs/errors | | LogsController@errors | auth, keyMaster:logs/errors | |
| | GET /admin/logs/errors/{name} | | LogsController@errors | auth, keyMaster:logs/errors | |
| | DELETE /admin/logs/errors | | LogsController@delete | auth, keyMaster:logs/errors | |
| | GET /admin/logs/events | | LogsController@events | auth, keyMaster:logs/events | |
| | GET /admin/logs/events/data | | LogsController@eventsData | auth, keyMaster:logs/events | |
etc...
I created a route that will list each route and its respective details in an html table.
Route::get('routes', function() {
$routeCollection = Route::getRoutes();
echo "<table style='width:100%'>";
echo "<tr>";
echo "<td width='10%'><h4>HTTP Method</h4></td>";
echo "<td width='10%'><h4>Route</h4></td>";
echo "<td width='80%'><h4>Corresponding Action</h4></td>";
echo "</tr>";
foreach ($routeCollection as $value) {
echo "<tr>";
echo "<td>" . $value->getMethods()[0] . "</td>";
echo "<td>" . $value->getPath() . "</td>";
echo "<td>" . $value->getActionName() . "</td>";
echo "</tr>";
}
echo "</table>";
});
You're probably still using an older version of the L4 beta. If you download a fresh copy, you'll see it listed when you run php artisan
.