src/Util/PharExtractor.php
public static function extractFile(string $filePath, bool $overwrite = false): string
    {
        $pharPath = \Phar::running(false);

        if (empty($pharPath)) {
            return '';
        }

        $relativeFilePath = substr($filePath, strpos($filePath, $pharPath) + strlen($pharPath) + 1);
        $tmpDir = sys_get_temp_dir().'/jolinotif';
        $extractedFilePath = $tmpDir.'/'.$relativeFilePath;

        if (!file_exists($extractedFilePath) || $overwrite) {
            $phar = new \Phar($pharPath);
            $phar->extractTo($tmpDir, $relativeFilePath, $overwrite);
        }

        return $extractedFilePath;
    }
public static function extractFile(string $filePath, bool $overwrite = false): string
    {
        $pharPath = \Phar::running(false);

        if (empty($pharPath)) {
            return '';
        }

        $relativeFilePath = substr($filePath, strpos($filePath, $pharPath) + strlen($pharPath) + 1);
        $tmpDir = sys_get_temp_dir().'/jolinotif';
        $extractedFilePath = $tmpDir.'/'.$relativeFilePath;

        if (!file_exists($extractedFilePath) || $overwrite) {
            $phar = new \Phar($pharPath);
            $phar->extractTo($tmpDir, $relativeFilePath, $overwrite);
        }

        return $extractedFilePath;
    }
public static function extractFile ( string $ filePath , bool $ overwrite = false ) : string { $ pharPath = \ Phar :: running ( false ) ; if ( empty ( $ pharPath ) ) { return '' ; } $ relativeFilePath = substr ( $ filePath , strpos ( $ filePath , $ pharPath ) + strlen ( $ pharPath ) + 1 ) ; $ tmpDir = sys_get_temp_dir ( ) . '/jolinotif' ; $ extractedFilePath = $ tmpDir . '/' . $ relativeFilePath ; if ( ! file_exists ( $ extractedFilePath ) || $ overwrite ) { $ phar = new \ Phar ( $ pharPath ) ; $ phar -> extractTo ( $ tmpDir , $ relativeFilePath , $ overwrite ) ; } return $ extractedFilePath ; }
Extract the file from the phar archive to make it accessible for native commands.

The absolute file path to extract should be passed in the first argument.
Extract the file from the phar archive to make it accessible for native commands .