title: How to retrieve all Variables from a Twig Template?
body: <p>Is it possible to retrieve all variables inside a Twig template with PHP? </p>
  
  <p>Example someTemplate.twig.php:</p>
  
  <pre><code>Hello {{ name }}, 
  your new email is {{ email }}
  </code></pre>
  
  <p>Now I want to do something like this: </p>
  
  <pre><code>$template = $twig-&gt;loadTemplate('someTemplate');
  $variables = $template-&gt;getVariables();
  </code></pre>
  
  <p>$variables should now contain "name" and "email".</p>
  
  <p>The reason I want to do this is that I am working on a CMS system 
  where my twig templates and variables are dynamically set by my users
  and they also fill the variables through an API. </p>
  
  <p>I want to set default values to not-set variables and therefore I 
  need a list of all variables that exist inside the template…</p>