title: Silex - How to access my web root and application root
body: <p>Are there are functions I can call via my $app variable (Silex\Application) to get access to the web root and application root?</p>
  
  <p>Assuming my project layout is like this</p>
  
  <pre><code>/src    &lt;-- Contains bootstrap.php (register all required services), controllers.php (routes)
  /vendor &lt;-- Contains autoload.php and Silex source
  /web    &lt;-- Contains index.php, Creates $app, includes app/bootstrap.php and $app-&gt;run()
  </code></pre>
  
  <p>And in src/controllers.php I might want to reference my doc root or app root</p>
  
  <pre><code>$app
      -&gt;get('/', function () use ($app) {
          // Would like to do something like
          $webRoot = $app-&gt;getWebRoot();
  
          return $app['twig']-&gt;render('home.html.twig');
      })
      -&gt;bind('home');
  </code></pre>
  
  <p>I have found something I can use in Twig templates but no convenience method in PHP</p>
  
  <pre><code>&lt;link href="{{ app.request.baseUrl }}/libs/bootstrap-3.2.0-dist/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" /&gt;
  </code></pre>
  
  <p>I can use __DIR__, dirname(), etc but was curious if there was another way</p>