PHPackages                             lexiphanic/doctrine-rest-driver - 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. [API Development](/categories/api)
4. /
5. lexiphanic/doctrine-rest-driver

ActiveLibrary[API Development](/categories/api)

lexiphanic/doctrine-rest-driver
===============================

RESTful API Driver for the Doctrine DBAL

2.2.3(10y ago)2208GPLPHPPHP &gt;=5.5

Since Mar 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Lexiphanic/DoctrineRestDriver)[ Packagist](https://packagist.org/packages/lexiphanic/doctrine-rest-driver)[ RSS](/packages/lexiphanic-doctrine-rest-driver/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (12)Versions (14)Used By (0)

Motivation
==========

[](#motivation)

The [CircleOfNice DoctrineRestDriver](https://github.com/CircleOfNice/DoctrineRestDriver) was a great starting point for a solution I required, however I found a couple of bugs so natually went to try and fix them but instead I found it difficult to follow and slightly confusing so ended up ripping it apart to A) fix the bugs, and B) learn more about the Doctrine DBAL

Prerequisites
=============

[](#prerequisites)

- This repo, ideally via [composer](https://getcomposer.org/)
- PHP 5.5 or later

Installation
============

[](#installation)

Add the driver to your project using composer:

```
composer require lexiphanic/doctrine-rest-driver
```

Change the following doctrine dbal configuration entries:

```
doctrine:
    dbal:
        connections:
            foo:
                driver_class: "Lexiphanic\\DoctrineRestDriver\\Driver"
                options:
                    client: http.rest.location # Service for sending request, EG Guzzle
                    transformer: http.rest.mysql.transformer # Service for transforming a query to Request
```

The CircleOfNice has lots of options that allow you to set various CURL options however they are not the concern of this project. This is the reason there are no futher options. So if you want to alter the requests, responses or transformers, then you can use middlewares in Guzzle for example or create your own transformer.

Usage
=====

[](#usage)

If your API routes follow these few conventions, using the driver is very easy:

- Each route must be structured the same: `{guzzle base_uri}/{tableName}`
- If there is an `id` column, this will be appended `{guzzle base_uri}/{tableName}/{id}`
- If the response is an array which only has an array eg `['children'=>[children...], 'parents'=>[parents...]]` then it is treated as a result with many rows, row 1 is `children...`, row 2 is `parents...` and so on, otherwise it is treated as a single resultset eg `['children'=>[...],'parents'=>[...]],'name'=>'...'` (this is because name is not an array) will return one row that has `name`, `children` and `parents` as properties
- Select requests will look like this;
    - `GET {guzzle base_uri}/{tableName}?foo=bar&bar(a,b)=foo` where the SQL was `SELECT ... FROM {tableName} WHERE foo = 'bar' AND bar(a,b) = 'foo'`
    - `GET {guzzle base_uri}/{tableName}/{id}?foo=bar` where the SQL was `SELECT ... FROM {tableName} WHERE foo = 'bar' AND id = {id}`;
- Delete requests follow the same convention as Select requests, but with the `Delete` verb ofcourse
- Insert requests will look like this;
    - `POST {guzzle base_uri}/{tableName}` the body of the request will be json encoded `key => value` pairs (see the Select request for examples on how they're created)
- Update requests are like Select and and Insert requests, like this;
    - `PUT {guzzle base_uri}/{tableName}/{id}?foo=bar` uri and querystrings follow the same convention as Select requests and the body will be the same as Insert requests
- All requests will use have the following appended if they exist on the SQL
    - `LIMIT foo, bar` will append `?_offset=foo&limit=bar` (`foo` and `bar` will be typecasted to `int`)
    - `ORDER BY foo, bar` will append `?_order=foo,bar`

If this is not the case, you can ofcourse use an alternative transformer, extend this transformer or add Guzzle middleware.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 75.4% 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 ~12 days

Recently: every ~4 days

Total

12

Last Release

3560d ago

Major Versions

0.2.2 → 2.2.32016-04-14

0.3.4 → 1.0.02016-08-11

### Community

Maintainers

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

---

Top Contributors

[![TobiasHauck](https://avatars.githubusercontent.com/u/6579735?v=4)](https://github.com/TobiasHauck "TobiasHauck (135 commits)")[![djaney](https://avatars.githubusercontent.com/u/2299010?v=4)](https://github.com/djaney "djaney (37 commits)")[![dmabelin-arcanys](https://avatars.githubusercontent.com/u/166811151?v=4)](https://github.com/dmabelin-arcanys "dmabelin-arcanys (5 commits)")[![JMLamodiere](https://avatars.githubusercontent.com/u/6639701?v=4)](https://github.com/JMLamodiere "JMLamodiere (1 commits)")[![mattsches](https://avatars.githubusercontent.com/u/68414?v=4)](https://github.com/mattsches "mattsches (1 commits)")

---

Tags

REST API doctrine ORM DBAL driver

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lexiphanic-doctrine-rest-driver/health.svg)

```
[![Health](https://phpackages.com/badges/lexiphanic-doctrine-rest-driver/health.svg)](https://phpackages.com/packages/lexiphanic-doctrine-rest-driver)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M650](/packages/sylius-sylius)[circle/doctrine-rest-driver

Use a REST API as if it was your local database

15634.5k](/packages/circle-doctrine-rest-driver)

PHPackages © 2026

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