MySource Matrix Developer

Main Content

Installing Snoopy

Requirements

Snoopy requires PHP 4.3.10 or greater. PHP 4.4.x is supported but PHP 5 is not. Snoopy also requires PEAR to be installed, as well as the following PEAR packages.
  • DB
  • XML_Tree
Note that the DB package is only required for testing MySource Matrix. If you are not installing the MySource Matrix specific Snoopy tests, you do not need need the PEAR::DB package.

If your system meets the requirements for MySource Matrix, you will be able to run Snoopy by simply installing the XML_Tree PEAR package.

Getting Snoopy

Installing Snoopy is very easy. All you have to do is download Snoopy and unpack it. The easiest way to get Snoopy is to download it directly from the MySource Matrix web site using a program such as wget or curl. Alternatively, you can download Snoopy here.

Running the following commands will download a copy of Snoopy using wget and unpack it to a directory called snoopy.

$ wget http://matrix.squiz.net/download/snoopy.tar.gz
$ tar -zxvf snoopy.tar.gz

If you don't have wget, you can also download Snoopy using curl. Running the following commands will download a copy of Snoopy using curl and unpack it to a directory called snoopy.

$ curl -OL http://matrix.squiz.net/download/snoopy.tar.gz
$ tar -zxvf snoopy.tar.gz

Placing Snoopy in a directory that is in your PATH will make running Snoopy easier. Instead of typing /path/to/snoopy/snoopy filename to run Snoopy over a file you can just enter snoopy filename from wherever you are.

The following command will create a symbolic link to Snoopy in your /usr/local/bin directory.

$ ln -s /path/to/snoopy/snoopy /usr/local/bin/snoopy

If you are not testing MySource Matrix code with Snoopy, you can stop here and learn how to use Snoopy. Otherwise, read on for help installing the MySource Matrix specific Snoopy tests.

Installing the MySource Matrix Snoopy Tests

MySource Matrix has its own set of Snoopy tests to ensure developers are correctly using various functions provided by MySource Matrix. These tests are not distributed with the main Snoopy download. If you are developing code for MySource Matrix, you must install the tests specific to MySource Matrix and ensure your code meets these additional standards.

The easiest way to get the MySource Matrix Snoopy tests is to download them directly from the MySource Matrix web site using a program such as wget or curl. Alternatively, you can download the MySource Matrix Snoopy tests here.

Running the following commands will download a copy of the MySource Matrix Snoopy tests using wget and install them into your current Snoopy installation.

The installation steps provided will replace the existing Snoopy table of contents with a copy of the official MySource Matrix coding standards table of contents. If you have modified your table of contents, you will have to merge your changes into the table of contents provided in the MySource Matrix Snoopy tests download.

$ cd /path/to/snoopy
$ wget http://matrix.squiz.net/download/mysource_matrix_tests.tar.gz
$ tar -zxvf mysource_matrix_tests.tar.gz
$ cp tests/toc.xml tests/toc.xml.orig
$ cp tests/mysource_toc.xml tests/toc.xml

If you don't have wget, you can also download the MySource Matrix Snoopy tests using curl. Running the following commands will download a copy of the MySource Matrix Snoopy tests using curl and install them into your current Snoopy installation.

$ cd /path/to/snoopy
$ curl -OL http://matrix.squiz.net/download/mysource_matrix_tests.tar.gz
$ tar -zxvf mysource_matrix_tests.tar.gz
$ cp tests/toc.xml tests/toc.xml.orig
$ cp tests/mysource_toc.xml tests/toc.xml

Once all that's complete, you're ready to start testing your PHP code using Snoopy. You can learn how to use Snoopy here.