PHPackages                             ronte-ltd/json-api-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. [API Development](/categories/api)
4. /
5. ronte-ltd/json-api-bundle

ActiveLibrary[API Development](/categories/api)

ronte-ltd/json-api-bundle
=========================

Our bundle to work with api due to jsonapi.org

311PHP

Since Nov 22Pushed 9y ago20 watchersCompare

[ Source](https://github.com/ronte-ltd/JsonApiBundle)[ Packagist](https://packagist.org/packages/ronte-ltd/json-api-bundle)[ RSS](/packages/ronte-ltd-json-api-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (3)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1b26c02a63d6963b10f7e99febbccad293ca6ac27bc7a69b1bc89b709565b191/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726f6e74652d6c74642f4a736f6e41706942756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ronte-ltd/JsonApiBundle/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c294b66443c841f9246c3688a19563136359eaef8590a91058e29bf7ea687b62/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726f6e74652d6c74642f4a736f6e41706942756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ronte-ltd/JsonApiBundle/?branch=master)

Symfony3 JsonApi REST Bundle
============================

[](#symfony3-jsonapi-rest-bundle)

Install
-------

[](#install)

### Composer

[](#composer)

```
composer require ronte-ltd/json-api-bundle
```

Init
----

[](#init)

### AppKernel.php

[](#appkernelphp)

```
new RonteLtd\JsonApiBundle\RonteLtdJsonApiBundle()
```

### config.yml

[](#configyml)

```
ronte_ltd_json_api:
    jsonapi:
        version: "1.0"
```

Use
---

[](#use)

### Entity

[](#entity)

```
use RonteLtd\JsonApiBundle\Annotation as JsonApi;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;

/**
 * City
 *
 * @ORM\Table(name="geo_cities")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\Common\EntityRepository")
 * @JsonApi\ObjectNormalizer(name="city")
 */
class City extends Entity
{
    /**
     * @var string
     *
     * @ORM\Column(name="titleShort", type="string", length=255, nullable=true)
     *
     * @JsonApi\Attribute(name="title_short")
     * @Groups({"default", "other"})
     */
    private $titleShort;

    /**
     * Country
     *
     * @var Country
     * @ORM\ManyToOne(targetEntity="Country", inversedBy="cities")
     * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
     *
     * @JsonApi\Relationship(name="countries")
     * @Groups({"default"})
     */
    protected $country;

```

### Controller

[](#controller)

```
use RonteLtd\JsonApiBundle\Controller\AbstractRestController;
use RonteLtd\JsonApiBundle\Annotation as JsonApi;

class TestController extends AbstractRestController
{
    /**
     * @param $id
     *
     * @JsonApi\Links({"self":"http://mydomain.com/api/v1/city"})
     * @JsonApi\Meta({"authors":{"Ruslan","Alexey"}})
     */
    public function getAction($id)
    {
        $city = $this->get('doctrine.orm.default_entity_manager')
                        ->getRepository('AppBundle:City')
                        ->find($id);

        return $this->renderJsonApi($city);
    }

    /**
     * @param $id
     *
     * @JsonApi\Links({"self":"http://mydomain.com/api/v1/cities"})
     * @JsonApi\Meta({"authors":{"Ruslan","Alexey"}})
     */
    public function getAllAction()
    {
        $result = $this->get('doctrine.orm.default_entity_manager')
            ->createQuery('SELECT c FROM AppBundle\Entity\City c')
            ->getResult();

        return $this->renderJsonApi($result);
    }
```

### Normalizer

[](#normalizer)

```
use RonteLtd\JsonApiBundle\Serializer\Normalizer\Collection;

$data = []; //Some objects collection or object

$collection = new Collection($data);

//Optional http://jsonapi.org/format/#document-top-level
$collection->setJsonapi(['version' => '1.0']);
$collection->setMeta(['authors' => ['Ruslan', 'Alexey']]); //Some metadata
$collection->setLinks(['self' => 'http://mydomain.com/api/v1/']); //JsonApi links

$jsonapiData = $this->get('serializer')->normalize($collection, 'json',
    [
        'groups' => ['default'],
        'enable_max_depth' => true,
//                'depth_AppBundle\Entity\City::country' => 4
    ]);
```

### Serializer

[](#serializer)

```
use RonteLtd\JsonApiBundle\Serializer\Normalizer\Collection;

$data = []; //Some objects collection or object

$collection = new Collection($data);

//Optional http://jsonapi.org/format/#document-top-level
$collection->setJsonapi(['version' => '1.0']);
$collection->setMeta(['authors' => ['Ruslan', 'Alexey']]); //Some metadata
$collection->setLinks(['self' => 'http://mydomain.com/api/v1/']); //JsonApi links

$jsonApi = $this->get('serializer')->serialize($collection, 'json');
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/25991ce361df82734652cfea588bd2ea729733b14dcc7a4699daa94af25e9921?d=identicon)[Cawa87](/maintainers/Cawa87)

---

Top Contributors

[![neiron486k](https://avatars.githubusercontent.com/u/3285712?v=4)](https://github.com/neiron486k "neiron486k (3 commits)")

### Embed Badge

![Health badge](/badges/ronte-ltd-json-api-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ronte-ltd-json-api-bundle/health.svg)](https://phpackages.com/packages/ronte-ltd-json-api-bundle)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M19](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k12](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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