Is there a way to determine at runtime if a PHP file is working as part of a phar archive?
ie, the inline implementation might look something like this:
function isRunningAsPhar() { $first_include = get_included_files()[0]; return strpos($first_include, '.phar') !== false; }
However, this may not work if the user renamed phar to have a different file extension, or symlinked phar to remove the file extension.
source share