Created
October 19, 2016 11:56
-
-
Save aldoanizio/346befa35a806f09ec512716e94bc0b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
// BuzzHttp | |
use Buzz\Browser; | |
use Buzz\Client\Curl; | |
// GuzzleHttp | |
use GuzzleHttp\Client; | |
// Guzzle | |
use Guzzle\Http\Client; | |
// Softr Asaas | |
use Softr\Asaas\Adapter\BuzzAdapter; | |
use Softr\Asaas\Adapter\GuzzleAdapter; | |
use Softr\Asaas\Adapter\GuzzleHttpAdapter; | |
use Softr\Asaas\Asaas; | |
/** | |
* Usando Buzz | |
*/ | |
// Aqui criamos o cliente da biblioteca Buzz e definimos o timeout | |
$buzzBrowser = new Browser(new Curl()); | |
$buzzBrowser->getClient()->setTimeout(10); | |
// Instancie o adapter usando o token de acesso e a instancia da biblioteca Buzz | |
$adapter = new BuzzAdapter('seu_token_de_acesso', $buzzBrowser); | |
/** | |
* Usando Guzzle | |
*/ | |
// Aqui criamos o cliente da biblioteca Guzzle e definimos o timeout | |
$guzzleClient = new new Client(); | |
$guzzleClient->setDefaultOption('timeout', 10); | |
// Instancie o adapter usando o token de acesso e a instancia da biblioteca Buzz | |
$adapter = new GuzzleAdapter('seu_token_de_acesso', $guzzleHttpClient); | |
/** | |
* Usando GuzzleHttp | |
*/ | |
// Aqui criamos o cliente da biblioteca GuzzleHTTP e definimos o timeout | |
$guzzleHttpClient = new Client(['timeout' => 10, 'headers' => ['access_token' => 'seu_token_de_acesso']]); | |
// Instancie o adapter usando o token de acesso e a instancia da biblioteca Buzz | |
$adapter = new GuzzleHttpAdapter('seu_token_de_acesso', $guzzleHttpClient); | |
// Instancie o cliente Asaas usando a instância do adapter previamente criada. | |
$asaas = new Asaas($adapter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment