PHP code example of jhowbhz / apigratis-sdk-php

1. Go to this page and download the library: Download jhowbhz/apigratis-sdk-php 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/ */

    

jhowbhz / apigratis-sdk-php example snippets




iBrasil\Service;

$login = Service::Auth("login", [
    "body" => [
        "email" => "[email protected]",
        "password" => "123456"
    ]
]);

var_dump($login);
die;



iBrasil\Service;

$logout = Service::Auth("logout", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
]);

var_dump($logout);
die;



iBrasil\Service;

$store = Service::Device("store", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "SecretKey" => "f87eb607-a8cc-43ea-b439.....",
    "body" => [
        "type" => "cellphone",
        "device_name" => "zap1",
        "device_key" => "zapzap1",
        "device_ip" => "198.29.10.50",
        "server_search" => "341d6f36-b888....",
        "webhook_wh_message" => "",
        "webhook_wh_status" => ""
    ]
]);

var_dump($store);
die;


use ApiBrasil\Service;

$update = Service::Device("search", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "body" => [
        "type" => "cellphone",
        "search" => "82faab0a-24f4-4b8b-9926-455ea9b3cdb7",
        "server_search" => "a2c85262-f830-4b90-a8da-ff67b7a7ed6e",
        "device_name" => "zap2",
        "device_key" => "zapzap1",
        "device_ip" => "198.29.10.50",
        "webhook_wh_message" => "",
        "webhook_wh_status":""
    ]
]);

var_dump($update);
die;


use ApiBrasil\Service;

$show = Service::Device("show", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "method" => "GET",
    "body" => [
        "search" => "82faab0a-24f4-4b8b-9926-455ea9b3cdb7",
    ]
]);

var_dump($show);
die;



iBrasil\Service;

$servers = Service::Server([
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "method" => "GET",
]);

var_dump($servers);
die;



iBrasil\Service;

$profile = Service::Profile([
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "method" => "GET",
]);

var_dump($profile);
die;



iBrasil\Service;

$plans = Service::Plan("all", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "method" => "GET",
]);

var_dump($plans);
die;

// ou obter o plano do usuario
$plan = Service::Plan("me", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "method" => "GET",
]);

var_dump($plan);
die;



iBrasil\Service;

$sendText = Service::WhatsApp("sendText", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "number" => "5531994359434",
        "text" => "🟢 Bem vindo ao APIBrasil"
    ]
]);

var_dump($sendText);
die;



iBrasil\Service;

$dados = Service::Vehicles("dados", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "placa" => "HBM6603",
    ]
]);

var_dump($dados);
die;



iBrasil\Service;

$ddd = Service::DDD("ddd", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "ddd" => "31",
    ]
]);

var_dump($ddd);
die;



iBrasil\Service;

$feriados = Service::HoliDays("feriados", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "type" => "facultativo",
        "date" => "07/09",
        "year" => "2024"
    ]
]);

var_dump($feriados);
die;



iBrasil\Service;

$fipe = Service::Vehicles("fipe", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "placa" => "HBM6603",
    ]
]);

var_dump($fipe);
die;



iBrasil\Service;

$rastreio = Service::Correios("rastreio", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "code" => "NL249695552BR",
    ]
]);

var_dump($rastreio);
die;



iBrasil\Service;

$address = Service::Correios("address", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "query" => "32146057",
    ]
]);

var_dump($address);
die;




iBrasil\Service;

$cnpj = Service::CNPJ("cnpj", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "cnpj" => "44.959.669/0001-80",
    ]
]);

var_dump($cnpj);
die;




iBrasil\Service;

$cep = Service::CEP("cep", [
    "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....",
    "DeviceToken" => "d019580b-3c8c-40e3-b9a0....",
    "body" => [
        "cep" => "32146057",
    ]
]);

var_dump($cep);
die;
bash
composer