Created
November 14, 2018 02:50
-
-
Save aalipar13/cdb6cf5b4c33a7c96de055a375e589a4 to your computer and use it in GitHub Desktop.
Export Laravel Routes in CSV format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generate a CSV of all the routes | |
*/ | |
Route::get('r', function() | |
{ | |
header('Content-Type: application/excel'); | |
header('Content-Disposition: attachment; filename="routes.csv"'); | |
$routes = Route::getRoutes(); | |
$fp = fopen('php://output', 'w'); | |
fputcsv($fp, ['METHOD', 'URI', 'NAME', 'ACTION']); | |
foreach ($routes as $route) { | |
fputcsv($fp, [head($route->methods()) , $route->uri(), $route->getName(), $route->getActionName()]); | |
} | |
fclose($fp); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here the source of that script https://www.terrymatula.com/development/2014/laravel-routes-generating-a-csv/