8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Allow clients to have a custom class name #123

Closed ruudk closed 7 years ago

ruudk commented 7 years ago

License: MIT

Allows you to configure the used class per client. This is esp useful when you use the Auto Wire function in Symfony 3.3.

Simply create a class like this:

<?php

declare(strict_types=1);

namespaceDemoBundle;

use GuzzleHttp\Client;

class PaymentsApiClient extends Client
{

}

And then configure your service like this:

guzzle:
    clients:
        payments_api:
            class: 'DemoBundle\PaymentsApiClient'
            base_url: '%payments_api_endpoint%'

Then you can use PaymentsApiClient as a dependency of your Guzzle Service

florianpreusner commented 7 years ago

Nice feature! Thanks for contributing, @ruudk!

ruudk commented 7 years ago

@florianpreusner Thanks for merging. Could you please tag a new release? :)

florianpreusner commented 7 years ago

Released in v6.1.0 (https://github.com/8p/GuzzleBundle/releases/tag/v6.1.0)