Chapter 1. Installing PHPSpec

Table of Contents

1.1. Installation
1.1.1. Installing PHPSpec with PEAR
1.1.2. Installing PHPSpec from a PEAR download
1.1.3. Installing PHPSpec Manually

1.1. Installation

PHPSpec should be installed using the PEAR Installer. PEAR (PHP Extension and Application Respository) is a simple, easy to use mechanism for distributing and managing PEAR packages. If you have PHP installed, chances are you already have a PEAR system ready to be utilised.

1.1.1. Installing PHPSpec with PEAR

PHPSpec is distributed primarily from its own dedicated PEAR channel. The PEAR Channel system is quite simple to use and eases the installation of PHPSpec in any scenario where you have access to your own PEAR installation. Before commencing an installation, you first need to "discover" the PHPSpec channel using the command:

pear channel-discover pear.phpspec.org

The newly discovered channel will have its details stored by PEAR.

Installing is dependent on the version, and preferred release state. At the time of writing PHPSpec is released as beta so you would use a command of the form:

pear install phpspec/PHPSpec-beta
[Note] Note

If PHPSpec has any stable release, the suffix "-beta" is not required.

[Note] Note

Development snapshots of PHPSpec are regularly updated at http://dev.phpspec.org. These snapshots are considered of dubious stability and should only be utilised for testing and feedback purposes. The installation of development snapshots is described in the "Installing PHPSpec Manually" section below.

1.1.2. Installing PHPSpec from a PEAR download

To install PHPSpec without using the PEAR channel system you can select a download of the PEAR archive from http://pear.phpspec.org/get and by running the following command:

pear install -f PHPSpec-0.2.0devel.tgz

PEAR will do all the hard work, including installing the phpspec command line script. In the future we will publish public releases using a dedicated PEAR channel. This installation option is not much different than installing normally through PEAR. If you require a fully manual installation process - the next section will help.

1.1.3. Installing PHPSpec Manually

To install PHPSpec manually, you can use the non-Pearified tarball called "PHPSpec-0.2.0beta.tar.gz" available for download from http://pear.phpspec.org/get/nonpear. Extract to your preferred location, and add the "src" directory to your php.ini include_path. You will also need to copy the phpspec script for your system (*.bat refers to a Windows friendly version) from the "scripts" directory to a location on your system PATH. This script must be edited to provide the location of the PHP binary executable as well as the path to the PHPSpec_Console_Command classfile.