Skip to content

poolerMF/ApiBundle

Repository files navigation

PlrAPI Bundle

Provide a basic logger of API request in toolbar.

This bundle is extension of playbloom/guzzle-bundle

Installation

$ php composer.phar require plr/api-bundle "1.*"

Enable the Bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
   $bundles = array(
       // ...
       new Playbloom\Bundle\GuzzleBundle\PlaybloomGuzzleBundle();
       new Plr\Bundle\ApiBundle\PlrApiBundle(),
   );
}

Configure the Bundle

plr_api:
    server1:
        log: true
        baseUrl: "http://www.example.com"
        parameters:
            jsonrpc: "2.0"
            custom_parameter: "11"
            ...
        user_agent: "Plr API"
        curl_options:
            CURLOPT_CONNECTTIMEOUT: 10
            CURLOPT_SSL_VERIFYPEER: false
            CURLOPT_SSLVERSION: 3
            ...
    server2:
        log: false
        ...

Example of usage

$response = $this->get('api.server1')->callJSON("client_login", ["login"=>"user", "password"=>"password"]);
echo $response["result"];

$response = $this->get('api.server1')->callJSON("client_login", [], "client.php");

Licence

This bundle is under the MIT license. See the complete license in the bundle

About

Log your API request in SF2 toolbar.

Resources

License

Stars

Watchers

Forks

Packages

No packages published