Command-line tool to convert PHP .phar archives to .zip.
This repo can ship ready-to-use binaries in dist/:
pharextractor-linux-amd64pharextractor-windows-amd64.exe
go build -buildvcs=false -o pharextractor ./cmd/pharextractorWindows:
go build -buildvcs=false -o pharextractor.exe ./cmd/pharextractorpharextractor input.phar
pharextractor input.phar -o output.zipIf -o is omitted, the output file is created next to the input file with
the .zip extension.
Linux:
chmod +x dist/pharextractor-linux-amd64
mkdir -p ~/.local/bin
cp dist/pharextractor-linux-amd64 ~/.local/bin/pharextractor
pharextractor input.pharIf ~/.local/bin is not in your PATH, add this line to ~/.bashrc or
~/.zshrc:
export PATH="$HOME/.local/bin:$PATH"Windows PowerShell:
mkdir C:\Tools\pharextractor
copy dist\pharextractor-windows-amd64.exe C:\Tools\pharextractor\pharextractor.exe
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Tools\pharextractor", "User")Open a new terminal, then run:
pharextractor input.phar
pharextractor input.phar -o output.zipFrom Linux/macOS:
GOOS=windows GOARCH=amd64 go build -buildvcs=false -o dist/pharextractor-windows-amd64.exe ./cmd/pharextractor
GOOS=linux GOARCH=amd64 go build -buildvcs=false -o dist/pharextractor-linux-amd64 ./cmd/pharextractor