Home

Awesome

Drest

Dress up doctrine entities and expose them as REST resources

Build Status Code Coverage Scrutinizer Quality Score Latest Stable Version Total Downloads Dependency Status HHVM Status License

This library allows you to quickly annotate your doctrine entities into restful resources. It comes shipped with it's own internal router, and can be used standalone or alongside your existing framework stack. Routes are mapped to either a default or customised service action that takes care of handling requests.

Setting up endpoints is as easy as adding in a simple annotation to an entity

/* @Drest\Resource(
 *    routes={
 *        @Drest\Route(
 *            name="get_user",
 *            route_pattern="/user/:id",
 *            verbs={"GET"}
 * )})
 * @ORM\Table(name="user")
 * @ORM\Entity
 */
class User
{
   .......
}

// hitting [GET] http://myapplication.com/user/123 may return:

{
  "user": {
    "name": "lee",
    "email": "lee@somedomain.com"
    ... + other attributes set up to be exposed ...
  }
}

Documentation

Check out how to use drest by reading the documentation

Features