Extracting files from .phar archive Extracting files from .phar archive php php

Extracting files from .phar archive


Extending on @pozs’s answer, you can actually use PharData->extractTo in a simple one-liner:

php -r '$phar = new Phar("phar-file.phar"); $phar->extractTo("./directory");'


Not sure if it's new, but under PHP 5.4.16 this works:

phar extract -f %some phar file%

The phar is extracted relative to your current working directory.


Yes, this library can do it: https://github.com/koto/phar-util

phar-extract library.phar output-directory