API logger bundle help your app with API calls monitoring
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
spec
src
.gitignore
.scrutinizer.yml
.travis.yml
README.md
composer.json
phpspec.yml

README.md

API Logger Bundle

Version Build Status Coverage Status Scrutinizer Code Quality License

Installation

Step 1: composer

composer require nixilla/api-logger-bundle

Step 2: enable bundle by adding it to AppKernel

<?php

    // app/AppKernel.php

    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
        // your other dev bundles here
        $bundles[] = new Nixilla\Api\LoggerBundle\NixillaApiLoggerBundle();
    }

Step 3: configuration

If you're use HWIOAuthBundle and you want to monitor all OAuth API calls, you can now override default hwi_oauth.http_client service used by this bundle by adding this few lines to your config_dev.yml file

# app/config/config_dev.yml
imports:
    - { resource: config.yml }

parameters:
    buzz.client.class: Nixilla\Api\LoggerBundle\Proxy\Buzz\Client\Curl

services:
    hwi_oauth.http_client:
        class: "%buzz.client.class%"
        calls:
            - [ "setLogger", [ "@nixilla.api.logger" ] ]

If you're using sensio/buzz-bundle, you may want to override the buzz.client in config_dev.yml

# app/config/config_dev.yml
imports:
    - { resource: config.yml }

parameters:
    buzz.client.class: Nixilla\Api\LoggerBundle\Proxy\Buzz\Client\Curl

services:
    buzz.client:
        class: "%buzz.client.class%"
        calls:
            - [ "setTimeout", [ "%buzz.client.timeout%" ] ]
            - [ "setLogger", [ "@nixilla.api.logger" ] ]

If you're using twilio/sdk you may want to override their Http Client in config_dev.yml

# app/config/config_dev.yml
imports:
    - { resource: config.yml }

services:
    
    twilio.http.client:
        class: Nixilla\Api\LoggerBundle\Proxy\Twilio\CurlClient
        calls:
            - [ "setLogger", [ "@nixilla.api.logger" ] ]
            
    twilio.rest.client:
        class: Twilio\Rest\Client
        arguments: [ "%twilio.username%", "%twilio.password%", ~, ~, '@twilio.http.client']