Skip to content

Instantly share code, notes, and snippets.

@aalipar13
Created November 14, 2018 02:50
Show Gist options
  • Select an option

  • Save aalipar13/cdb6cf5b4c33a7c96de055a375e589a4 to your computer and use it in GitHub Desktop.

Select an option

Save aalipar13/cdb6cf5b4c33a7c96de055a375e589a4 to your computer and use it in GitHub Desktop.

Revisions

  1. aalipar13 created this gist Nov 14, 2018.
    16 changes: 16 additions & 0 deletions routes.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    /**
    * 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);
    });