资源说明:Sonno is a lightweight PHP framework based loosely on Jersey, a Java ReST framework reference implementation of the JAX-RS specification.
Contribution Guidelines
-----------------------
### Coding Standard ###
We strictly adhere to the Zend Framework coding standard. Before pushing to the
origin, you should run
[PHP_CodeSniffer](http://pear.php.net/package/PHP_CodeSniffer "phpcs"):
`$ phpcs --standard=zend src`. All errors and warnings
should be cleaned up before making a pull request.
### Add Test Cases ###
We try to keep our Code Coverage high and our CRAP index low. Before submitting
a pull request, run the PHPUnit test suite and ensure that all tests pass.
If you add functionality or fix a bug, please include test cases to cover the
code you've sumitted.
Additional Resources
--------------------
- [Api Documentation](http://sonno.360i.com/docs/api "Api Docs")
- [Copy of the license](http://sonno.360i.com/LICENSE.txt "License")
[](https://travis-ci.org/360i/sonno)
Sonno - A RESTful PHP Framework!
================================
Sonno is a lightweight PHP framework based loosely on
[Jersey](http://jersey.java.net/ "Jersey"), a Java ReST framework reference
implementation of the [JAX-RS](http://jcp.org/en/jsr/detail?id=311 "JAX-RS")
specification.
Plain-Old-PHP objects are configured with a set of annotations describing
a set of Resources.
``` php
_request->getRequestBody();
// ... Do some processing of $data, then save it...
$response = new Response();
return $response->setCreated('http://example.sonno.dev/users/10');
}
}
```
License
-------
Sonno is licensed under the New BSD license. A copy can be
found here:
[http://sonno.360i.com/LICENSE.txt](http://sonno.360i.com/LICENSE.txt)
Dependencies
------------
The current version of Sonno supports configuring a ReSTful web application
via annotations. Rather than reinvent the wheel and develop our own annotation
reader, we've provided interfaces and adapters. The adapter that ships with
this version uses Doctrine-Common version >= 2.1.1. That's not to say that any
developer couldn't implement their own annotation reader, then build an adapter
that implements Sonno\Annotation\Reader\ReaderInterface.
Here's an example of how a Sonno application can be configured using Doctrine's
annotation reader:
``` php
parseConfig();
```
Summary of Annotations
-----------------------
| Annotation | Target | Description |
| @Path | Class, Method | Specifies a relative path for a resource. When used on a class this annotation identifies that class as a root resource. When used on a method this annotation identifies a sub-resource method or locator. |
| @Consumes | Class, Method | Specifies a list of media types that can be consumed. |
| @Produces | Class, Method | Specifies a list of media types that can be produced. |
| @Context | Property | Identifies an injection target for a Request object. |
| @DELETE | Method | Specifies that the annotated method handles HTTP DELETE requests. |
| @GET | Method | Specifies that the annotated method handles HTTP GET requests. |
| @HEAD | Method | Specifies that the annotated method handles HTTP HEAD requests. |
| @OPTIONS | Method | Specifies that the annotated method handles HTTP OPTIONS requests. |
| @POST | Method | Specifies that the annotated method handles HTTP POST requests. |
| @PUT | Method | Specifies that the annotated method handles HTTP PUT requests. |
| @PathParam | Method | Specifies that the value of a method parameter is to be extracted from the request URI path. The value of the annotation identifies the name of a URI template parameter. |
| @QueryParam | Method | Specifies that the value of a method parameter is to be extracted from a URI query parameter. The value of the annotation identifies the name of a query parameter. |
| @CookieParam | Method | Specifies that the value of a method parameter is to be extracted from a HTTP cookie. The value of the annotation identifies the name of a the cookie. |
| @FormParam | Method | Specifies that the value of a method parameter is to be extracted from a form parameter in a request entity body. The value of the annotation identifies the name of a form parameter. Note that whilst the annotation target allows use on fields and methods, the specification only requires support for use on resource method parameters. |
| @HeaderParam | Method | Specifies that the value of a method parameter is to be extracted from a HTTP header. The value of the annotation identifies the name of a HTTP header. |
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。
English
