PHP code example of leonardo-max / contaazul

1. Go to this page and download the library: Download leonardo-max/contaazul library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leonardo-max / contaazul example snippets


$
use ContaAzul\ContaAzul;
use ContaAzul\Helpers\Helpers;


//VARIÁVEIS NECESSÁRIAS PARA INICIALIZAÇÃ0
$client_id="SEU_CLIENT_ID";
$client_secret="SEU_SECRET_ID";
$redirect_uri="URL_DE_REDIRECIONAMENTO";// pega a url atual para negociar os pedidos da URL de redirecionamento.
$scope="sales";
$state=Helpers::generateRandomString(16);

//INSTANCIANDO A CLASSE
$apiContaazul=new ContaAzul($client_id,$client_secret,$redirect_uri,$scope,$state);



if(isset($_REQUEST['code'])){
	$getToken=$apiContaazul->requestToken($_REQUEST['code']);
  }
  

  $getToken=$apiContaazul->refreshToken($refresh_token);

  $request=$apiContaazul->request($endpoint,$parametros,$token,$metodo);