highly extensible, highly enjoyable, BDD testing framework for PHP.


Testing with Peridot is natural. Write tests using the familiar describe-it syntax. Easily and clearly describe how your code should behave in a language that makes sense. See getting started.


Peridot is event driven, so writing plugins or ad hoc extensions is painless. Peridot events and scopes allow you to easily add test helpers, custom reporters, and plugins. WebDriver? Databases? Your framework of choice? No problem. We believe in a small core with endless possibilities.


Peridot is lightweight. Peridot suites load and run faster than similar PHPUnit or phpspec suites. Have slow or bulky integration tests? No problem, Peridot can run your tests concurrently.

Installing Peridot

Peridot can be installed several ways:


# global composer install
$ composer global require peridot-php/peridot:~1.15

# ensure .composer/vendor/bin is on your PATH
$ export PATH="$PATH:$HOME/.composer/vendor/bin"

# local per project install (recommended)
$ composer require peridot-php/peridot:~1.15

Manual install

# download the latest phar
$ sudo wget http://peridot-php.github.io/downloads/peridot.phar -O /usr/local/bin/peridot

# or if you prefer curl
$ sudo curl http://peridot-php.github.io/downloads/peridot.phar -o /usr/local/bin/peridot

# make it executable
$ sudo chmod a+x /usr/local/bin/peridot

Manual install (local)

Download Latest Stable Phar

Getting Started

Peridot uses the familiar describe-it syntax to create a clear and readable testing language.

<?php //arrayobject.spec.php
describe('ArrayObject', function() {
    beforeEach(function() {
        $this->arrayObject = new ArrayObject(['one', 'two', 'three']);

    describe('->count()', function() {
        it("should return the number of items", function() {
            $count = $this->arrayObject->count();
            assert($count === 3, "expected 3");

$ peridot arrayobject.spec.php

      ✓ should return the number of items

  1 passing (19 ms)


 peridot [options] [files]

 --grep (-g)          Run tests matching <pattern> (default: *.spec.php)
 --no-colors (-C)     Disable output colors
 --reporter (-r)      Select which reporter to use (default: spec)
 --bail (-b)          Stop on failure
 --configuration (-c) A php file containing peridot configuration
 --reporters          List all available reporters
 --version (-V)       Display the Peridot version number
 --help (-h)          Display this help message.

-g, --grep

Only run test files whose name matches the provided pattern. The default grep pattern is *.spec.php

-C, --no-colors

Disable colors in output.

-r, --reporter

Select which reporter to use. This is the reporter name registered via ReporterFactory::register.

-b, --bail

Tell peridot to stop running tests as soon as there is a failure.

-c, --configuration

A path to a peridot configuration file. Defaults to getcwd() . '/peridot.php'


List available test reporters.

Example Test Suites

You can head over to the Peridot GitHub organization for plenty of examples using Peridot.

We would love to see other projects using Peridot, so if you have a project that uses it, we would love to know. Feel free to message us and let us know. We will gladly list your project on the site.

Running Peridot's tests

Peridot's tests were written using Peridot. After cloning Peridot, you can run tests using:

$ bin/peridot specs/