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