title: How can i define global variables in slim framework
body: <p>How can i define a global variable such that my current_user method can work were ever i want it to, all i simple need to do is check if there is a current user my example code is below </p>
  
  <pre><code>    if (isset($_SESSION['company_id'])) {
         $current_user = Companies::find($_SESSION['company_id']);
       }
      else
     {
      $current_company = null;
     }
  </code></pre>
  
  <p>how can i use the current user method where ever i want without passing it to my <code>app-&gt;render()</code> method just like in my header.html</p>
  
  <pre><code>{% if current_user %}
   hi {{current_user.name}}
  {% endif %}
  </code></pre>