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

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

wizards/rest-bundle
===================

Integration of php-rest-api into Symfony.

0.10.6(6y ago)14.9k4[1 PRs](https://github.com/wizardstechnologies/rest-api-bundle/pulls)MITPHPPHP &gt;7CI failing

Since Sep 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/wizardstechnologies/rest-api-bundle)[ Packagist](https://packagist.org/packages/wizards/rest-bundle)[ RSS](/packages/wizards-rest-bundle/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (12)Versions (45)Used By (0)

Symfony bundle for wizards/php-rest-api

[![Build Status](https://camo.githubusercontent.com/9cde72ddf28309148c7d6a058823451607b56759e9745f18979dbfa10b6d02d6/68747470733a2f2f7472617669732d63692e6f72672f77697a61726473746563686e6f6c6f676965732f726573742d6170692d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wizardstechnologies/rest-api-bundle)

Helps you create a REST API in an expressive and streamlined way. It will help you conceive mature and discoverable APIs, thanks to the jsonapi specification. Regardless of the output serialization, the request format will be the same. Have a look at  for further documentation and explanations. You can find an example project on

Requirements
============

[](#requirements)

```
symfony >= 4.4
php >= 7.3

```

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

[](#installation)

```
composer require wizards/rest-bundle

```

Configuration
=============

[](#configuration)

Create a configuration file with the following values:

```
# config/bundles/wizards_rest.yaml
wizards_rest:
	data_source: orm|array # Choose between ORM and Array for your data source. More will be added soon
	reader: annotation|array
	format: jsonapi|array
	base_url: your_url

```

Usage
=====

[](#usage)

Create a REST API the easy and configurable way !

This bundle ease the use of wizard's php rest api, and provide some extra goodies for symfony:

- [a subscriber](https://github.com/wizardstechnologies/rest-api-bundle/blob/master/Subscriber/SerializationSubscriber.php) to automatically serialize your responses
- [a subscriber](https://github.com/wizardstechnologies/rest-api-bundle/blob/master/Subscriber/ExceptionSubscriber.php) to automatically serialize your exceptions
- [a param converter](https://github.com/wizardstechnologies/rest-api-bundle/blob/master/Subscriber/ExceptionSubscriber.php) to inject PSR-7 requests in your controllers
- [a multi-part exception](https://github.com/wizardstechnologies/rest-api-bundle/blob/master/ParamConverter/Psr7ParamConverter.php) to easily serialize multiple errors (such as the one from forms)
- [a controller trait](https://github.com/wizardstechnologies/rest-api-bundle/blob/master/Controller/JsonControllerTrait.php) that helps on serializing input data from json and jsonapi

If you use symfony flex, those services will be automatically registered.

To serialize a single resource, just return the object from a controller:

```
public function getArtistAction(string $id, EntityManagerInterface $entityManager)
{
    try {
        $artist = $entityManager->find(Artist::class, $id);
    } catch (\Exception $exception) {
        throw new NotFoundHttpException('Artist not found.');
    }

    return $artist;
}

```

Note that we don't use the param injector for the entity as we want to be able to dispatch an error ourselves so it is properly formatted.

To Serialize a collection, use the collectionManager

```
public function getArtistsAction(CollectionManager $collectionManager, ServerRequestInterface $request)
{
    return $collectionManager->getPaginatedCollection(Artist::class, $request);
}

```

To deserialize input, use the json trait

```
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Wizards\RestBundle\Controller\JsonControllerTrait;

class ArtistController extends AbstractController
{
    use JsonControllerTrait;
	public function postArtistAction(Request $request, EntityManagerInterface $entityManager)
    {
        $artist = new Artist();
        $form = $this->createForm(ArtistType::class, $artist);
        $this->handleJsonForm($form, $request);

        if (!$form->isValid()) {
            $this->throwRestErrorFromForm($form);
        }

        $entityManager->persist($artist);
        $entityManager->flush();

        return $artist;
    }
}

```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

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

Recently: every ~55 days

Total

42

Last Release

1991d ago

Major Versions

0.10.6 → 1.0-alpha2020-06-10

PHP version history (2 changes)0.1PHP &gt;7

1.0-alphaPHP &gt;=7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/730113?v=4)[K](/maintainers/wizards)[@Wizards](https://github.com/Wizards)

---

Top Contributors

[![BigZ](https://avatars.githubusercontent.com/u/42766?v=4)](https://github.com/BigZ "BigZ (85 commits)")[![antoineangot](https://avatars.githubusercontent.com/u/747436?v=4)](https://github.com/antoineangot "antoineangot (2 commits)")[![neeckeloo](https://avatars.githubusercontent.com/u/1768645?v=4)](https://github.com/neeckeloo "neeckeloo (1 commits)")[![vmonjaret](https://avatars.githubusercontent.com/u/9928313?v=4)](https://github.com/vmonjaret "vmonjaret (1 commits)")

---

Tags

apirestjsonapiHATEOAS

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[api-platform/core

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

2.6k51.2M331](/packages/api-platform-core)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.4k67.4M260](/packages/nelmio-api-doc-bundle)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[api-platform/state

API Platform state interfaces

274.9M131](/packages/api-platform-state)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M556](/packages/shopware-core)[moonshine/moonshine

Laravel administration panel

1.3k253.1k78](/packages/moonshine-moonshine)

PHPackages © 2026

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