Skip to content

Instantly share code, notes, and snippets.

@aalipar13
Created November 14, 2018 02:50
Show Gist options
  • Save aalipar13/cdb6cf5b4c33a7c96de055a375e589a4 to your computer and use it in GitHub Desktop.
Save aalipar13/cdb6cf5b4c33a7c96de055a375e589a4 to your computer and use it in GitHub Desktop.
Export Laravel Routes in CSV format
/**
* 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);
});
@Crepu
Copy link

Crepu commented May 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment