Fork me on GitHub

Presto Simpler REST with PHP

Test your setup

  1. Point Apache at the examples/ folder of presto.
  2. Point your browser at the VHOST configured in #1.
  3. All tests should pass.

Using Presto in your own projects

  1. Clone the Presto library repo to a functioning web root:
$ git clone git:// lib/presto

The web root will need to be accessible by Apache, be able to execute PHP, and honour .htaccess rules.

  1. Add default routing using the example .htaccess file:
$ cp lib/presto/lib/htaccess-example .htaccess
  1. Link API delegator to your API root:
$ ln -s lib/presto/lib/delegator-index.php api.php

This file sets up Presto's delegator features, so that your classes are called in a predictable way via HTTP requests.

  1. Copy the example API file and test:
$ cp lib/presto/setup-tests/info.php .
$ curl [YOUR WEBROOT]/info.json 
{"example":"This is some example information"}

The example API file writes a simple DOM (a PHP keyed array) as JSON back to the client (which is cURL in this case).


  • PHP 5.3 or greater is required
  • The JSON PHP extensions must be enabled
  • .htaccess must be enabled in Apache (it's off by default in many installations)

Installing on a DH PS

You need to enable the JSON extension using a custom RC (not a custom .ini). Find the instructions here: