phlib/messagebird-guzzle-client
, (*1)
MessageBird Guzzle HTTP client implementation., (*2)
Allows you to replace the Message Bird HTTP Client with an implementation that uses the Guzzle HTTP Client. This means
there is a more control over certain options in the client., (*3)
Install
Via Composer, (*4)
``` bash
$ composer require phlib/messagebird-guzzle-client, (*5)
## Creating a HTTP Client
``` php
<?php
use Phlib\MbGuzzleClient\Http\Client;
use GuzzleHttp\Client as GuzzleClient;
$guzzleClient = new GuzzleClient($options = []);
$httpClient = new Client(MessageBird\Client::ENDPOINT, $guzzleClient);
Using the HTTP Client with MessageBird
``` php, (*6)
$messageBird = new \MessageBird\Client('YOUR_ACCESS_KEY', $httpClient);, (*7)
// OR, (*8)
$messageBird = new \Phlib\MbGuzzleClient\Client('YOUR_ACCESS_KEY');, (*9)
// Get you balance
$balance = $messageBird->balance->read();, (*10)
```, (*11)
Problems
HTTPClient injection through constructor is wrongfully reused, (*12)
When constructing the MessageBird client with a custom HTTP client implementation, as is done here, the side effect is
that the same client is used for API and Chat API endpoints., (*13)
License
This package is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version., (*14)
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details., (*15)
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see http://www.gnu.org/licenses/., (*16)