PHP code example of robmachado / apigranatum

1. Go to this page and download the library: Download robmachado/apigranatum 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/ */

    

robmachado / apigranatum example snippets


use ApiGranatum\Granatum;
use ApiGranatum\Connector;

$token = 'lkjd786487648746jhjhe989389syhhhwuh9837398739hdskh';
$version = 'v1';
$uri = 'https://api.granatum.com.br';

try {
    $conn = new Connector($token, $version, $uri);
    $b = Granatum::bancos($conn);
    $resp = $b->all();
    if ($resp === 'false') {
        echo "Falhou ...";
    } elseif ($resp === 'true') {
        echo "Operação realizada com Sucesso!!";
    } else {
        echo "<pre>";
        print_r($resp);
        echo "</pre>";
    }
} catch (\Exception $e) {
    echo $e->getMessage();
}