PharTools is a powerful PHP-CLI tool to manage phar (PHP-Archive) files. It allows to create, extract, edit and view phar archives. It also includes a simple API to implement PharTools features on your own scripts.
Features:
- Create phar archives
- Extract phar archives
- Add, rename, delete, list files inside phar archives
- Get informations about phar archives (such as filesize, metadata, stub, etc...)
- Converts zip or tar archives to phar archives
- Converts phar archives to zip or tar archives
- Supports GZip and BZip2 compression types (BZip2 needs the php_bz2 extension which is already included on the Windows installer)
Don't run this script directly. Run it from a cmd.exe or from a Linux Terminal instance instead
If you install PharTools on Windows directories (like Program Files, Program Files (x86), ...) you may need to run cmd.exe as Administrator
To create phar files you need to set php.readonly to 0 in php.ini configuration
To configure PharTools on Windows you need only to edit %PHP_PATH% in phartools.cmd file by setting the right php executable path.
On Linux, PharTools usually doesn't require to be configured but if you have some problems, edit phartools.sh file.
If you are running PharTools on Windows you can simply run it calling phartools.cmd on command shell. On Linux you have to run phartools using ./phartools.sh instead.
phartools -h (Windows)
./phartools.sh -h (Linux)
phartools -a <phar_archive> <file>
file can be either a file or a non-empty directory.
phartools -c <destination_phar> <source_dir | source_file> [options]
options switches:
-zgzip|-zbzip2 Compress the phar file using gzip or bzip2 compression
-m<metadata> Add metadata to the phar file (metadata format must be like 'key=>value,key2=>value2')
-s<stub> Set stub string for the phar
-r<regex> Include only files matching the regular expression
phartools -d <phar_archive> <file>
file can be either a file or a directory.
phartools -e <phar_archive> [extract_path]
If extract_path is not specified, the archive will be extracted in the current directory
phartools -i <phar_archive>
phartools -l <phar_archive>
phartools -r <phar_archive> <oldname> <newname>
phartools -a2p <archive> [compression]
Currently supported compression types are gzip and bzip2
phartools -p2a <phar_archive> [options]
options switches:
-zgzip|-zbzip2 Set output compression type
-ozip|-otar Set output archive type
All platforms:
PharTools_v2.0.zip (Script only)
Windows:
PharTools_v2.0_win_installer (Preconfigured Script + Precompiled PHP binaries)
PharTools_v2.0_win_portable (Preconfigured Script + Precompiled PHP binaries, No Installer)
Please note that precompiled PHP binaries provided in the Portable and Installer versions are provided with minimal extensions and configuration
1. Open Windows Command Shell

2. Go to PharTools directory

3. Run PharTools

1. Open Linux Terminal

2. Go to PharTools directory

3. Run PharTools

If you want you can support this project with a small donation by clicking 💵 here. Your generosity will help us paying web hosting, domains, buying programs (such as IDEs, debuggers, etc...) and new hardware to improve software development. Thank you 😄
If you want to contribute to this project please follow the Contribution Guidelines
