Installation¶
Requirements¶
Puli requires PHP 5.3.9 or higher.
Installing the Puli CLI¶
To use Puli, you first need to install the Puli Command Line Interface (CLI). This is usually done only once on a system.
You can install the Puli CLI in one of three ways:
As a Phar (Recommended)¶
Download the puli.phar
from the latest release page on GitHub. You can
test whether the Phar works by running:
$ php puli.phar
Note
The leading $
in the code examples is a convention that tells you that
the example contains shell code. Type the command that follows the dollar
sign into your terminal, but don’t type the $
itself.
You can either place the Phar in your project directory or somewhere in your
path (such as /usr/local/bin
) and chmod it to 755
. You can rename it to
just puli
to avoid typing puli.phar
for every command.
The Phar can be updated with the self-update
command:
$ php puli.phar self-update
Note
For this command to work you need PHP 5.6 or higher.
As a Global Composer Dependency¶
If you prefer to install tools like PHPUnit as global Composer dependencies, you can do the same for Puli. Install Composer and enter the following command in a terminal:
$ composer global require puli/cli:^1.0
As a Composer Dependency¶
If you want to explicitly document which version of the Puli CLI is required by your project, you can add it to your Composer dependencies. Install Composer and enter the following command in a terminal:
$ composer require --dev puli/cli:^1.0
OS X Only: Using Homebrew¶
If you are on OS X, you can also install Puli through Homebrew:
$ brew install puli
Note: This command requires Homebrew PHP to be installed.
Unix Only: Disable Glob Expansion¶
By default, Unix shells like Bash expand glob arguments before passing them to the called command. Look at this short example for a demonstration:
# What you type
$ command *.js
# What the command receives by the shell
$ command script1.js script2.js ...
If you use Puli on a Unix system, you should disable glob expansion for the
puli
command. If you use Bash, add the following lines to ~/.bashrc
:
# Disable glob expansion for Puli
alias puli='set -f;puli';puli(){ command puli "$@";set +f;}
Apply the changes with the source
command:
$ source ~/.bashrc
If you use a different shell than Bash, see this answer on StackOverflow for instructions.
Next Steps¶
Read The Repository Component to learn how to register your resources with Puli.