- Point Apache at the
examples/
folder of presto. - Point your browser at the VHOST configured in #1.
- All tests should pass.
- Clone the Presto library repo to a functioning web root:
$ git clone git://github.com/robotpony/Presto.git lib/presto
The web root will need to be accessible by Apache, be able to execute PHP, and honour .htaccess
rules.
- Add default routing using the example
.htaccess
file:
$ cp lib/presto/lib/htaccess-example .htaccess
- 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.
- 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)
You need to enable the JSON extension using a custom RC (not a custom .ini). Find the instructions here: