PHIVE cheat sheet

A quick reference for PHIVE with the most important commands and options. Read it online below, or download the printable PDF.

Download PDF

Introduction

PHIVE (PHAR Installation and Verification Environment) is a tool to install and update PHP Archive (PHAR) files while verifying their signatures. It can be used to install development tools like PHPUnit, Composer, PHPStan, etc. while isolating them from the project's runtime dependencies. Tools can be installed either locally in a tools directory or globally in the PATH.

Installation

Follow the instructions on https://phar.io/#Install.

Global options

Option Description
--home=<dir> Use a different home directory instead of the default ~/.phive
--no-progress Disable progress bars

Getting started

Command Description
phive composer Parse composer.json to suggest PHARs to install
phive skel Generate a default phive.xml configuration file

Installing PHARs

Command Description
phive list List available PHAR aliases
phive install <alias> Install a PHAR using its alias
phive install <url> Install a PHAR using a GitHub/GitLab project URL or direct download URL
phive install --copy <alias> Copy the PHAR to the current directory instead of creating a symlink
phive install --global <alias> Install globally instead of in the current directory
phive install --trust-gpg-keys <key> Install a PHAR and trust the given GPG key

Managing PHARs

Command Description
phive status List all installed PHARs for the current project
phive status --global List all globally installed PHARs
phive status --all List all installed PHARs across all projects
phive remove <alias> Remove an installed PHAR
phive purge Delete all unused PHARs

Updating PHARs

Command Description
phive outdated List all installed PHARs that have a newer version available
phive update Update all installed PHARs
phive update <alias> Update a specific PHAR
phive update --prefer-offline Try to use locally available PHARs instead of downloading them
phive update --global Update all globally installed PHARs

Other commands

Command Description
phive help Show help information
phive version Show version information
phive selfupdate Update PHIVE to the latest version
phive update-repository-list Update the list of available PHARs