title: Static content inside phar archive
body: <p>I was just wondering if it is legal to add static content to phar archives (images, javascript or html files). And if so, how do I get them out to serve to a client? </p>
  
  <p>The only example I've seen so far was:</p>
  
  <pre><code>&lt;?php
  header('Content-type: image/jpeg');
  echo file_get_contents('phar:///fullpath/to/coollibrary.phar/images/wow.jpg');
  ?&gt;
  </code></pre>
  
  <p>but I guess this is not a way to go.</p>
  
  <p>UPATE:
  Just in case someone will be trying to do the same. This piece of code set as a stub of a phar archive worked for me:</p>
  
  <pre><code>&lt;?php
      Phar::interceptFileFuncs();
      Phar::mungServer(array('REQUEST_URI'));
      Phar::webPhar();
      __HALT_COMPILER();
  ?&gt;
  </code></pre>
  
  <p>All static content inside the phar archive still passes through the php interpreter, but at least there is no need do stuff like setting header mime type and serving the static file content with readfile() manually. Those functions in the phar stub make it look transparent.</p>