title: Generate Automatic documentation SlimFramework
body: <p>I have a simple RESTful API that is already built using Slim Framework.</p>
  
  <p><strong>Example of code:</strong></p>
  
  <pre><code>$app-&gt;group('/settings','authenticate','is_admin',function () use($app){
      $app-&gt;get('/gear', function () use ($app) {
          ...
      });
  
      $app-&gt;group('/users',function() use($app){
          $app-&gt;get('/', function () use ($app) {...});
          $app-&gt;post('/', function () use ($app) {...});
          $app-&gt;put('/:id', function ($id) use ($app) {...});
          $app-&gt;delete('/:id', function () use ($app) {...});
      });
  });
  </code></pre>
  
  <p>Now, I need to build a simple page that list all my routes groups as 'resources' and nest the routes under each group so that I can add some sort of text documentation for each route group/method which I will persist later either in database or in file storage.</p>
  
  <p>In summary my questions are: </p>
  
  <ol>
  <li>Is there something like that already exists?</li>
  <li>How can I list all routes and route groups in Slim Framework?</li>
  </ol>
  
  <p><strong>My current Hack:</strong></p>
  
  <pre><code>$app-&gt;get('/', function () use ($app) {
      $data=[];
      //$router-&gt;routes is a protected variable, so i had to change it to public, same for $r-&gt;methods and pattern
      foreach($app-&gt;router-&gt;routes as $r){
          $x = explode('/',$r-&gt;pattern);
          $x = $x[1];
          $data[$x][$r-&gt;methods[0]][]=$r-&gt;pattern."[".implode(',',$r-&gt;middleware)."]";
      }
      print_r($data);
  });
  </code></pre>
  
  <p>I gives a result like so:</p>
  
  <pre><code>Array
  (
      [auth] =&gt; Array
          (
              [GET] =&gt; Array
                  (
                      [0] =&gt; /auth/me[authenticate]
                      [1] =&gt; /auth/logout[]
                  )
  
              [POST] =&gt; Array
                  (
                      [0] =&gt; /auth/login[]
                  )
  
              [DELETE] =&gt; Array
                  (
                      [0] =&gt; /auth/logout[]
                  )
  
          )
  
      [settings] =&gt; Array
          (
              [GET] =&gt; Array
                  (
                      [0] =&gt; /settings/classes[authenticate,is_admin]
                      [1] =&gt; /[authenticate,is_admin]
                  )
  
              [POST] =&gt; Array
                  (
                      [0] =&gt; /settings/grades/:id/class[authenticate,is_admin]
                      [1] =&gt; /settings/grades/:id/subject[authenticate,is_admin]
                      [2] =&gt; /settings/departments/:id/grade[authenticate,is_admin]
                      [3] =&gt; /settings/subjects/:id/skills[authenticate,is_admin]
                  )
  
          )
  </code></pre>