neofusion / json-rpc-bundle
JSON-RPC 2.0 Server for Symfony
Installs: 3 495
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 3
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^5.5.9|^7.0
- symfony/framework-bundle: ^2.7|^3.0|^4.0
Requires (Dev)
- symfony/asset: ^2.7|^3.0|^4.0
- symfony/browser-kit: ^2.7|^3.0|^4.0
- symfony/phpunit-bridge: ^3.2|^4.0
- symfony/templating: ^2.7|^3.0|^4.0
- symfony/translation: ^2.7|^3.0|^4.0
- symfony/yaml: ^2.7|^3.0|^4.0
This package is not auto-updated.
Last update: 2022-04-30 06:39:46 UTC
README
JSON-RPC 2.0 Server for Symfony
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 routescustomer
- internal name of a routepath
- second part of URL after prefixmethods
- list of methodscomment.create
- method nameservice
- name of a service, which contains callable methodsaction
- 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