PHPackages                             innmind/rest-bundle - 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. innmind/rest-bundle

Abandoned → [innmind/rest-server-bundle](/?search=innmind%2Frest-server-bundle)ArchivedSymfony-bundle[HTTP &amp; Networking](/categories/http)

innmind/rest-bundle
===================

This Bundle wraps the innmind rest server library

2.0.2(10y ago)022.3kMITPHPPHP &gt;=5.5

Since Sep 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Innmind/RestBundle)[ Packagist](https://packagist.org/packages/innmind/rest-bundle)[ Docs](http://github.com/Innmind/RestBundle)[ RSS](/packages/innmind-rest-bundle/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (11)Versions (20)Used By (0)

RestBundle
==========

[](#restbundle)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/56a6e9ac5a7ebfb0beec495956c6ba89dc682cc444a8299df8f7cd499eaea6c1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f5265737442756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Innmind/RestBundle/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/03350f01231069819e13822c6337e2f7721ccbf48bdde226eb8b4fcfed96ee4a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f5265737442756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Innmind/RestBundle/?branch=master)[![Build Status](https://camo.githubusercontent.com/fde0f9f8ec2025f624e9748324f95e564db5ed93ce5ecdc4356adff3b03c0143/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e6e6d696e642f5265737442756e646c652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Innmind/RestBundle/build-status/master)

[![SensioLabsInsight](https://camo.githubusercontent.com/aa40283309383616a05ff1a05ce8845b9c40126736231229ff4026bcf8aa1ee0/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64353431613462632d353562622d343930372d396435642d3831646661383339353633642f6269672e706e67)](https://insight.sensiolabs.com/projects/d541a4bc-55bb-4907-9d5d-81dfa839563d)

Wrapper for the `innmind/rest-server` library allowing you to easily expose a REST L3 API.

This bundle offer a complete integration of the library in a symfony project. It also add a new feature called server capabilities; put simply, it expose a route `OPTIONS *` that will output the list of routes exposed via this bundle. The goal being to allow client discovery, you could imagine a REST client that could prefetch all the resources definitions so it could know in advance if the resources it will try to send match the definitions.

Installation
------------

[](#installation)

```
composer require innmind/rest-bundle
```

Enable the bundle by adding the following line in your `app/AppKernel.php` of your project:

```
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Innmind\RestBundle\InnmindRestBundle,
        );
        // ...
    }
    // ...
}
```

Then specify your resources in the configuration under:

```
innmind_rest:
    server:
        collections: [] #same configuration as the rest server library
        prefix: /api/prefix #optional
```

Server
------

[](#server)

### Storage

[](#storage)

To define a storage you can create a service having either `innmind_rest.server.storage.abstract.doctrine` or `innmind_rest.server.storage.abstract.neo4j` as parent. Then you need to specify the first argument to construct the service, being an instance of an entity manager (a doctrine or neo4j one); and flag the service with the tag `innmind_rest.server.storage`, the bundle will look for the attribute `alias` on this tag to use as reference afterward (name used to specify storage on your resources).

### Formats

[](#formats)

As allowed formats are handled via encoders, you declare new ones with a tag on the encoder service you want to add.

Example of the built-in `json` format:

```
innmind_rest.server.serializer.encoder.json:
    class: Innmind\Rest\Server\Serializer\Encoder\JsonEncoder
    tags:
        - { name: serializer.encoder }
        - { name: innmind_rest.server.format, format: json, mime: application/json, priority: 10 }
```

### Events

[](#events)

In most cases the only event you'll want to alter will be `KernelEvents::RESPONSE` or `Events::{STORAGE}_READ_QUERY_BUILDER` (`STORAGE` can be `DOCTRINE` or `NEO4J`) to add restriction on the query like for example the user being connected.

You can look at [`Events.php`](https://github.com/Innmind/rest-server/blob/master/Events.php) to review all the events you have at your disposition.

Client
------

[](#client)

To consume an API you need to use the `innmind_rest.client` service. Examples of usages:

```
use Innmind\Rest\Client\HttpResource;

$client = $container->get('innmind_rest.client');

$resources = $client->getServer('http://example.com')->read('some_resource');
$resource = $client->getServer('http://example.com')->read('some_resource', 42);

$toCreate = new HttpResource;
$toCreate->set('someProperty', 'value');
$client->getServer('http://example.com')->create('some_resource', $toCreate);

$toUpdate = new HttpResource;
$toUpdate
    ->set('all', 'properties')
    ->set('must', 'be set');
$client->getServer('http://example.com')->update('some_resource', 42, $toUpdate);

$client->getServer('http://example.com')->remove('some_resource', 42);
```

You can use `$server->getResources()` to view all the resources exposed by the server API; it will return an associative array with the names as keys and the definitions as values.

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

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

Recently: every ~18 days

Total

18

Last Release

3773d ago

Major Versions

1.0.x-dev → 2.0.02015-11-22

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (101 commits)")

---

Tags

apirest

### Embed Badge

![Health badge](/badges/innmind-rest-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/innmind-rest-bundle/health.svg)](https://phpackages.com/packages/innmind-rest-bundle)
```

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)[sylius/sylius

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

8.4k5.6M647](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M151](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M385](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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