JSON-RPC 2.0 Server for Symfony
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Controller
DependencyInjection
Resources/config
Routing
Tests
Utils
.gitignore
.travis.yml
LICENSE
NeoFusionJsonRpcBundle.php
README.md
composer.json
phpunit
phpunit.xml.dist

README.md

NeoFusionJsonRpcBundle

JSON-RPC 2.0 Server for Symfony

Build Status Coverage Status Scrutinizer Code Quality

SensioLabsInsight

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require neofusion/json-rpc-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new NeoFusion\JsonRpcBundle\NeoFusionJsonRpcBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Configure API methods

You can easily define methods in your configuration file:

neofusion_jsonrpc:
    routing:
        customer:
            path: /customer
            methods:
                comment.create: { service: 'app.api.customer.comment', action: 'create' }
                comment.delete: { service: 'app.api.customer.comment', action: 'delete' }
  • routing - list of routes
  • customer - internal name of a route
  • path - second part of URL after prefix
  • methods - list of methods
  • comment.create - method name
  • service - name of a service, which contains callable methods
  • action - callable method from the service

Step 4: Register the routes

Finally, register this bundle's routes by adding the following to your project's routing file:

# app/config/routing.yml
neofusion_jsonrpc:
    resource: "@NeoFusionJsonRpcBundle/Resources/config/routing.yml"
    prefix: /api