Update README.md

This commit is contained in:
PJ Dietz 2013-01-31 21:26:02 -05:00
parent 206b7d5c2a
commit 6c58c1446b
1 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
WellRESTed
==========
WellRESted provides classes to help you create RESTful APIs and work with HTTP requests and responses.
WellRESTed provides classes to help you create RESTful APIs and work with HTTP requests and responses.
@ -17,7 +17,7 @@ Requirements
Install
-------
Add an entry for "pjdietz/wellrested" in your composer.json file's **require** property. If you are not already using Composer, create a file in your project called **composer.json** with the following content:
Add an entry for "pjdietz/wellrested" to your composer.json file's **require** property. If you are not already using Composer, create a file in your project called **composer.json** with the following content:
```json
{
@ -34,13 +34,16 @@ $ curl -s https://getcomposer.org/installer | php
$ php composer.phar install
```
You can now use WellRESTed by including the autoload.php file generated by Composer. (vendor/autoload.php)
Examples
--------
### Responses
Build a response and use it to send output.
Use a Response instance to build a response and send output. The Request class makes it easy to set the status code, add headers, and set the response body.
```php
$resp = new \pjdietz\WellRESTed\Response();
@ -53,7 +56,9 @@ exit;
### Requests
You can access a Request singleton instance that represents the request sent to the current script.
Use the Request class read information about the request sent to the server. You can ready the headers, method, and message body.
Request provides a singlton instance representing the request sent to the current script.
```php
$rqst = \pjdietz\WellRESTed\Request::getRequest();
@ -64,7 +69,7 @@ if ($rqst->method === 'PUT') {
}
```
The Request class can also make a request to another server and provide the response as a Respones object. (This feature requires [PHP's cURL](http://php.net/manual/en/book.curl.php).)
The Request class can also make a request to another server and provide the response as a Respones object. (This feature requires [PHP cURL](http://php.net/manual/en/book.curl.php).)
```php
// Prepare a request.
@ -120,5 +125,4 @@ class MyRouter extends \pjdietz\WellRESTed\Router
More explamples
---------------
For more examples, see the project [pjdietz/wellRrested-samples](https://github.com/pjdietz/wellrested-samples).
For more examples, see the project [pjdietz/wellrested-samples](https://github.com/pjdietz/wellrested-samples).