PHPackages                             leedavis81/drest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. leedavis81/drest

ActiveLibrary[HTTP &amp; Networking](/categories/http)

leedavis81/drest
================

Create a fully featured REST API service from Doctrine 2 Entity annotations.

1.0.5(9y ago)8726.0k12[2 issues](https://github.com/leedavis81/drest/issues)[1 PRs](https://github.com/leedavis81/drest/pulls)MITPHPPHP ~5.4|~7.0

Since Jul 29Pushed 9y ago7 watchersCompare

[ Source](https://github.com/leedavis81/drest)[ Packagist](https://packagist.org/packages/leedavis81/drest)[ RSS](/packages/leedavis81-drest/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (7)Dependencies (8)Versions (11)Used By (0)

Drest
=====

[](#drest)

### Dress up doctrine entities and expose them as REST resources

[](#dress-up-doctrine-entities-and-expose-them-as-rest-resources)

[![Build Status](https://camo.githubusercontent.com/61e49535ca027f4ec92ecd095a8899d95502a3565be69b9fc675de173d8b813f/68747470733a2f2f7472617669732d63692e6f72672f6c6565646176697338312f64726573742e737667)](https://travis-ci.org/leedavis81/drest/settings)[![Code Coverage](https://camo.githubusercontent.com/20ed8101cae273306bf0d03601551def57e966c1ae3851155b08b12b0b9e8672/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6565646176697338312f64726573742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/leedavis81/drest/?branch=master)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/864eca25d70b1411b13809e4df6c73daabc7565f93e09c2a4115928048dcf7f5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6565646176697338312f64726573742f6261646765732f7175616c6974792d73636f72652e706e673f733d35343635356166326166626432363334313763396538306134643665653936363430383362356335)](https://scrutinizer-ci.com/g/leedavis81/drest/)[![Latest Stable Version](https://camo.githubusercontent.com/be5e58a036e3b0c64fa698b614d25b058dbea4a729c129b089edf8ffa5667e2c/68747470733a2f2f706f7365722e707567782e6f72672f6c6565646176697338312f64726573742f762f737461626c652e706e67)](https://packagist.org/packages/leedavis81/drest)[![Total Downloads](https://camo.githubusercontent.com/db5b0c1dd728b0618f156dff10958ed6d4ad6305525ed905eccb986987a9d961/68747470733a2f2f706f7365722e707567782e6f72672f6c6565646176697338312f64726573742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/leedavis81/drest)[![Dependency Status](https://camo.githubusercontent.com/695c7afe543b944a09230ad6870093be78caae85d74ca4d430aadba8f014b716/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3531393465633636323936643631303030323030303334332f62616467652e706e67)](https://www.versioneye.com/user/projects/5194ec66296d610002000343)[![HHVM Status](https://camo.githubusercontent.com/f09ed319758d7029d015348ca9bc9c59ddda3f6464148cafcde1e2eb7a00193a/687474703a2f2f6868766d2e683463632e64652f62616467652f6c6565646176697338312f64726573742e737667)](http://hhvm.h4cc.de/package/leedavis81/drest)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](http://opensource.org/licenses/MIT)

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
-------------

[](#documentation)

Check out how to use drest by [reading the documentation](http://leedavis81.github.io/drest/)

Features
--------

[](#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.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 93.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~197 days

Recently: every ~70 days

Total

8

Last Release

3382d ago

Major Versions

v1.0.0 → v2.0.0.x-dev2016-03-08

PHP version history (4 changes)v1.0.0-betaPHP &gt;=5.3.3

v1.0.0PHP &gt;=5.4.0

v2.0.0.x-devPHP ^5.5|^7.0

1.0.1PHP ~5.4|~7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f124d2489389e8961373ab602ebf50a8b7c65ed185fc2e748a2431cb81307c9e?d=identicon)[leedavis81](/maintainers/leedavis81)

---

Top Contributors

[![leedavis81](https://avatars.githubusercontent.com/u/624973?v=4)](https://github.com/leedavis81 "leedavis81 (260 commits)")[![ptheberge](https://avatars.githubusercontent.com/u/4975258?v=4)](https://github.com/ptheberge "ptheberge (16 commits)")[![jenkins-nrg](https://avatars.githubusercontent.com/u/11049876?v=4)](https://github.com/jenkins-nrg "jenkins-nrg (1 commits)")[![kurund](https://avatars.githubusercontent.com/u/151481?v=4)](https://github.com/kurund "kurund (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

apirestdoctrine2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/leedavis81-drest/health.svg)

```
[![Health](https://phpackages.com/badges/leedavis81-drest/health.svg)](https://phpackages.com/packages/leedavis81-drest)
```

###  Alternatives

[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k52.2M371](/packages/api-platform-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M776](/packages/sylius-sylius)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.5M254](/packages/api-platform-metadata)[api-platform/doctrine-common

Common files used by api-platform/doctrine-orm and api-platform/doctrine-odm

294.9M55](/packages/api-platform-doctrine-common)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
