leedavis81 / drest
Create a fully featured REST API service from Doctrine 2 Entity annotations.
Installs: 26 017
Dependents: 0
Suggesters: 0
Security: 0
Stars: 87
Watchers: 8
Forks: 12
Open Issues: 3
Requires
- php: ~5.4|~7.0
- doctrine/common: ~2.3
- doctrine/inflector: ~1.0
- leedavis81/drest-common: ^1.0
- zendframework/zend-code: ~2.0
Requires (Dev)
- doctrine/orm: ~2.3
- leedavis81/altr-ego: ~1.0
- phpunit/phpunit: ~4.1
- symfony/http-foundation: ~2.0
Suggests
- symfony/http-foundation: If you're not using Drest with an existing framework adapters (see documentation) then you MUST include this
- symfony/yaml: If you plan on using the YAML driver you MUST include this.
This package is not auto-updated.
Last update: 2024-11-09 14:46:12 UTC
README
Dress up doctrine entities and expose them as REST resources
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
-
Quickly annotate existing Doctrine entities to become a fully functional REST resource.
-
Utilises the internal router for matching resource route patterns.
-
Specify what data you want to expose from your entities (including relations), or let the client choose!
-
Generate data objects using exposable data for your API users to consume.
-
Comes shipped with both JSON and XML representations, or you can create your own.
-
Allows media type detection from your client requests, getting you one step close to RMM level 3.
-
Use it independently from your existing framework stack, or alongside it.
-
Allows extension points so you can configure requests to your specific needs.