All Projects → koemeet → JsonApiBundle

koemeet / JsonApiBundle

Licence: other
Integration of JSON API with Symfony using JMS Serializer

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to JsonApiBundle

Angular2 Jsonapi
A lightweight Angular 2 adapter for JSON API
Stars: ✭ 202 (+260.71%)
Mutual labels:  json-api
Json Apis With Github
🔨 Tool to make Simple and Quick JSON APIs with GitHub.
Stars: ✭ 240 (+328.57%)
Mutual labels:  json-api
druxt.js
The Fully Decoupled Drupal Framework
Stars: ✭ 96 (+71.43%)
Mutual labels:  json-api
Yin
The efficient and elegant JSON:API 1.1 server library for PHP
Stars: ✭ 214 (+282.14%)
Mutual labels:  json-api
Crnk Framework
JSON API library for Java
Stars: ✭ 234 (+317.86%)
Mutual labels:  json-api
Api Generator
PHP-code generator for Laravel framework, with complete support of JSON-API data format
Stars: ✭ 244 (+335.71%)
Mutual labels:  json-api
Ck Caffe
Collective Knowledge workflow for Caffe to automate installation across diverse platforms and to collaboratively evaluate and optimize Caffe-based workloads across diverse hardware, software and data sets (compilers, libraries, tools, models, inputs):
Stars: ✭ 192 (+242.86%)
Mutual labels:  json-api
xijs
A business - oriented scene Js Library
Stars: ✭ 91 (+62.5%)
Mutual labels:  json-api
Iotwifi
Raspberry Pi (arm) wifi configuration container. Configure and control wifi connectivity with a JSON based REST api.
Stars: ✭ 236 (+321.43%)
Mutual labels:  json-api
rest-api
Laravel restfull api boilerplate
Stars: ✭ 57 (+1.79%)
Mutual labels:  json-api
Jsonapi Rb
Efficiently produce and consume JSON API documents.
Stars: ✭ 219 (+291.07%)
Mutual labels:  json-api
Json2typescript
Convert JSON to TypeScript with secure type checking!
Stars: ✭ 230 (+310.71%)
Mutual labels:  json-api
Hotels server
酒店预订系统后台管理系统
Stars: ✭ 249 (+344.64%)
Mutual labels:  json-api
Marshmallow Jsonapi
JSON API 1.0 (https://jsonapi.org/) formatting with marshmallow
Stars: ✭ 203 (+262.5%)
Mutual labels:  json-api
fn
No description or website provided.
Stars: ✭ 28 (-50%)
Mutual labels:  json-api
Aimeos Symfony
Symfony e-commerce bundle for professional, ultra fast online shops, complex B2B applications and #gigacommerce
Stars: ✭ 194 (+246.43%)
Mutual labels:  json-api
Jsonapi Rails
Rails gem for fast jsonapi-compliant APIs.
Stars: ✭ 242 (+332.14%)
Mutual labels:  json-api
php-serializer
Serialize PHP variables, including objects, in any format. Support to unserialize it too.
Stars: ✭ 47 (-16.07%)
Mutual labels:  json-api
drupal-jsonapi-params
A package to manage json-api params
Stars: ✭ 42 (-25%)
Mutual labels:  json-api
TypeScript-in-Nodejs-Starter
A starter kit for Node.js project written with TypeScript.
Stars: ✭ 39 (-30.36%)
Mutual labels:  json-api

JsonApiBundle

Join the chat at https://gitter.im/steffenbrem/JsonApiBundle

Integration of JSON API with Symfony 2 (FOSRestBundle)

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

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

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

Annotations

@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 
 {
  // ...
 }
Property Default Required Content Info
type ~ No string If left default, it will resolve its type dynamically based on the short class name.
showLinkSelf true No boolean Add self link to the resource

@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

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;
 }
Property Default Required Content Info
includeByDefault false No boolean This will include (sideload) the relationship with it's primary resource
showData false No boolean Shows data, which consists of ids of the relationship data
showLinkSelf false No boolean Add self link of the relationship
showLinkRelated false No boolean Add related link of the relationship

Configuration Reference

# app/config/config.yml

mango_json_api:
    show_version_info: true

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"
                    }
                }
            }
        }
    ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].