yproximite/yprox-api-client-bundle

Integration of yProx API client library for Symfony

Installs: 3 819

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 10

Forks: 0

Open Issues: 0

Type:symfony-bundle

v3.0.0 2020-11-03 12:05 UTC

This package is auto-updated.

Last update: 2024-04-29 03:47:02 UTC


README

Installation

Require yproximite/yprox-api-client-bundle to your composer.json file:

$ composer require yproximite/yprox-api-client-bundle

Register the bundle in app/AppKernel.php:

// app/AppKernel.php
public function registerBundles()
{
    return [
        // ...
        new Yproximite\Bundle\YproxApiClientBundle\YproxApiClientBundle(),
    ];
}

Configuration

Here is the configuration reference:

# app/config/config.yml
yprox_api_client:

    # Identifier of the service that represents "Http\Client\HttpClient"
    http_client: httplug.client.guzzle6

    clients:

        # Simple example
        default:
            api_key: xxxxx

        # Advanced example
        custom:
            api_key: yyyyy
            base_url: http://api.host.com

Usage

// yprox_api_client.service_aggregator.<client_name_from_config>
$api = $this->get('yprox_api_client.service_aggregator.default');

$message = new ArticleListMessage();
$message->setSiteId(1);

// Yproximite\Api\Model\Article\Article[]
$articles = $api->article()->getArticles($message);