I'm just wondering if it was legal to add static content to phar archives (images, javascript or html files). And if so, how do I get them to serve the customer?
The only example I've seen so far:
<?php header('Content-type: image/jpeg'); echo file_get_contents('phar:///fullpath/to/coollibrary.phar/images/wow.jpg'); ?>
but I think this is not an option.
UPATE: Just in case, someone will try to do the same. This part of the code, installed as a stub of the phar archive, worked for me:
<?php Phar::interceptFileFuncs(); Phar::mungServer(array('REQUEST_URI')); Phar::webPhar();
All static content inside the phar archive still passes through the php interpreter, but at least there is no need to do such things as setting the mime type of the header and serving the static contents of the file with readfile () manually. These functions in the phar stub look transparent.
facha
source share