Below is a list of example uses of the Tonic library. View each example to see it in action.
An example authentication resource, the isSecured() method can be used to ensure that only authorised users can access the resource. username: user password: pass
This example loads files from the filesystem to be used as resource representations and provides a resource collection to contain them within. It also demonstrates the ability to add resources to the collection, and update and delete resources from within the collection.
This example outputs a simple hello world message and the details of the request and response as generated by Tonic. It also demonstrates etags and "if none match" functionality.
This example outputs a simple HTML form and gathers the POSTed data
A representation is an output format for a resource. A single resource can have many output representations that can differ depending on the request data. Representations are built up as strings within the Response object and it is down to the programmer to implement the desired logic for choosing and building a required representation. This example produces three different representations of the resource data depending on the request accept header information.
Using Smarty for representation generation