Search by

druidvav / api-service-bundle

druidvav

Package info

github.com/druidvav/sf-api-service-bundle

Type:symfony-bundle

pkg:composer/druidvav/api-service-bundle

Statistics

Installs: 5 307

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

v4.4.2 2026-10-12 16:39 UTC

README

Installation

Step 1: Download DvApiServiceBundle using composer

Require the druidvav/api-service-bundle with composer Composer.

$ composer require druidvav/api-service-bundle

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
            new Druidvav\ApiServiceBundle\DvApiServiceBundle(),
        // ...
    );
}

Step 3: Configure the DvApiServiceBundle

# app/config/config.yml

dv_api_service:
    logger: "@monolog.logger.api"

Step 4: Define your api service files

# src/AppBundle/Resources/config/services.yml

services:
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

    AppBundle\ApiService\:
        resource: '../../ApiService/*'
        tags: [ "jsonrpc.api-service" ]

JSON-RPC request params

JsonRpcRequest accepts JSON-RPC 2.0 requests with an integer or string id, a nonblank method, and a required params object or array. An object supplies named parameters; an array supplies positional parameters. For example:

{"jsonrpc":"2.0","id":0,"method":"item.get","params":{"code":"A1"}}

getParams() continues to return a PHP array, and getParam() returns a value from that array, for compatibility with existing services. Nested JSON objects and arrays are both decoded as PHP arrays.