PHPackages                             steffenbrem/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. [HTTP &amp; Networking](/categories/http)
4. /
5. steffenbrem/json-api-bundle

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

steffenbrem/json-api-bundle
===========================

Integration of JSON API with Symfony2 using JMS Serializer (FOSRestBundle).

0.2(9y ago)549.5k25[9 issues](https://github.com/steffenbrem/JsonApiBundle/issues)[1 PRs](https://github.com/steffenbrem/JsonApiBundle/pulls)MITPHPPHP &gt;=5.3.9

Since Sep 12Pushed 7y ago9 watchersCompare

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

READMEChangelog (2)Dependencies (7)Versions (5)Used By (0)

JsonApiBundle
=============

[](#jsonapibundle)

[![Join the chat at https://gitter.im/steffenbrem/JsonApiBundle](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/steffenbrem/JsonApiBundle?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Integration of JSON API with Symfony 2 (FOSRestBundle)

> Note that this is stil a WIP and should not be used for production!

Usage
-----

[](#usage)

> Coming soon

If you want to experiment with this implementation, you can just enable this bundle in your `AppKernel` and everything should work directly. Try to serialize some annotated php classes and check it out!

### Configuration reference

[](#configuration-reference)

```
mango_json_api:
    show_version_info: true # default
    base_uri: /api # default
```

Annotations
-----------

[](#annotations)

### @Resource

[](#resource)

This will define your class as a JSON-API resource, and you can optionally set it's type name.

> This annotation can be defined on a class.

```
use Mango\Bundle\JsonApiBundle\Configuration\Annotation as JsonApi;

/**
 * @JsonApi\Resource(type="posts", showLinkSelf=true)
 */
 class Post
 {
  // ...
 }
```

PropertyDefaultRequiredContentInfotype~NostringIf left default, it will resolve its type dynamically based on the short class name.showLinkSelftrueNobooleanAdd `self` link to the resource### @Id (optional, it defaults to `id`)

[](#id-optional-it-defaults-to-id)

This will define the property that will be used as the `id` of a resource. It needs to be unique for every resource of the same type.

> This annotation can be defined on a property.

```
use Mango\Bundle\JsonApiBundle\Configuration\Annotation as JsonApi;

/**
 * @JsonApi\Resource(type="posts")
 */
 class Post
 {
    /**
     * @JsonApi\Id
     */
    protected $uuid;
 }
```

### @Relationship

[](#relationship)

This will define a relationship that can be either a `oneToMany` or `manyToOne`. Optionally you can set `includeByDefault` to include (sideload) the relationship with it's primary resource.

> This annotation can be defined on a property.

```
use Mango\Bundle\JsonApiBundle\Configuration\Annotation as JsonApi;

/**
 * @JsonApi\Resource(type="posts")
 */
 class Post
 {
    // ..

    /**
     * @JsonApi\Relationship(includeByDefault=true, showLinkSelf=false, showLinkRelated=false)
     */
    protected $comments;
 }
```

PropertyDefaultRequiredContentInfoincludeByDefaultfalseNobooleanThis will include (sideload) the relationship with it's primary resourceshowDatafalseNobooleanShows `data`, which consists of ids of the relationship datashowLinkSelffalseNobooleanAdd `self` link of the relationshipshowLinkRelatedfalseNobooleanAdd `related` link of the relationshipConfiguration Reference
-----------------------

[](#configuration-reference-1)

```
# app/config/config.yml

mango_json_api:
    show_version_info: true
```

Example response
----------------

[](#example-response)

> GET /api/channels

```
{
    "jsonapi": {
        "version": "1.0"
    },
    "meta": {
        "page": 1,
        "limit": 10,
        "pages": 1,
        "total": 4
    },
    "data": [
        {
            "type": "channels",
            "id": 5,
            "attributes": {
                "code": "WEB-UK",
                "name": "UK Webstore",
                "description": null,
                "url": "localhost",
                "color": "Blue",
                "enabled": true,
                "created-at": "2015-07-16T12:11:50+0000",
                "updated-at": "2015-07-16T12:11:50+0000",
                "locales": [],
                "currencies": [],
                "payment-methods": [],
                "shipping-methods": [],
                "taxonomies": []
            },
            "relationships": {
                "workspace": {
                    "data": {
                        "type": "workspaces",
                        "id": 18
                    }
                }
            }
        },
        {
            "type": "channels",
            "id": 6,
            "attributes": {
                "code": "WEB-NL",
                "name": "Dutch Webstore",
                "description": null,
                "url": null,
                "color": "Orange",
                "enabled": true,
                "created-at": "2015-07-16T12:11:50+0000",
                "updated-at": "2015-07-16T12:11:50+0000",
                "locales": [],
                "currencies": [],
                "payment-methods": [],
                "shipping-methods": [],
                "taxonomies": []
            },
            "relationships": {
                "workspace": {
                    "data": {
                        "type": "workspaces",
                        "id": 18
                    }
                }
            }
        },
        {
            "type": "channels",
            "id": 7,
            "attributes": {
                "code": "WEB-US",
                "name": "United States Webstore",
                "description": null,
                "url": null,
                "color": "Orange",
                "enabled": true,
                "created-at": "2015-07-16T12:11:50+0000",
                "updated-at": "2015-07-16T12:11:50+0000",
                "locales": [],
                "currencies": [],
                "payment-methods": [],
                "shipping-methods": [],
                "taxonomies": []
            },
            "relationships": {
                "workspace": {
                    "data": {
                        "type": "workspaces",
                        "id": 18
                    }
                }
            }
        },
        {
            "type": "channels",
            "id": 8,
            "attributes": {
                "code": "MOBILE",
                "name": "Mobile Store",
                "description": null,
                "url": null,
                "color": "Orange",
                "enabled": true,
                "created-at": "2015-07-16T12:11:50+0000",
                "updated-at": "2015-07-16T12:11:50+0000",
                "locales": [],
                "currencies": [],
                "payment-methods": [],
                "shipping-methods": [],
                "taxonomies": []
            },
            "relationships": {
                "workspace": {
                    "data": {
                        "type": "workspaces",
                        "id": 18
                    }
                }
            }
        }
    ],
    "included": [
        {
            "type": "workspaces",
            "id": 18,
            "attributes": {
                "name": "First Workspace"
            },
            "relationships": {
                "channels": {
                    "links": {
                        "related": "/workspaces/18/channels"
                    }
                }
            }
        }
    ]
}
```

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

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

Total

3

Last Release

3421d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1cee8b0807644941f18adb7154d6c8e86df45d65fa23ee4d4d97eacf63978f67?d=identicon)[steffenbrem](/maintainers/steffenbrem)

---

Top Contributors

[![koemeet](https://avatars.githubusercontent.com/u/1569156?v=4)](https://github.com/koemeet "koemeet (64 commits)")[![drewclauson](https://avatars.githubusercontent.com/u/10655807?v=4)](https://github.com/drewclauson "drewclauson (3 commits)")[![chernecov](https://avatars.githubusercontent.com/u/2867987?v=4)](https://github.com/chernecov "chernecov (2 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")[![olivermack](https://avatars.githubusercontent.com/u/666035?v=4)](https://github.com/olivermack "olivermack (1 commits)")[![qooplmao](https://avatars.githubusercontent.com/u/2874965?v=4)](https://github.com/qooplmao "qooplmao (1 commits)")

---

Tags

fosrestbundlejmsserializerbundlejson-apirestjsonapiJSON-API

### Embed Badge

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

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

###  Alternatives

[kimai/kimai

Kimai - Time Tracking

4.7k8.7k1](/packages/kimai-kimai)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k66.1M253](/packages/nelmio-api-doc-bundle)[api-platform/core

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

2.6k50.1M314](/packages/api-platform-core)[sulu/sulu

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

1.3k1.4M196](/packages/sulu-sulu)[willdurand/hateoas-bundle

Integration of Hateoas into Symfony2.

29515.5M49](/packages/willdurand-hateoas-bundle)[api-platform/symfony

Symfony API Platform integration

354.0M110](/packages/api-platform-symfony)

PHPackages © 2026

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