PHP code example of total-voice / php-client

1. Go to this page and download the library: Download total-voice/php-client 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/ */

    

total-voice / php-client example snippets



// Consideramos que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->chamada->ligar('NUMERO-A', 'NUMERO-B');

echo $response->getContent();



// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->chamada->buscaChamada('ID_CHAMADA');

echo $response->getContent(); // {}



// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->chamada->encerrar('ID_CHAMADA');

echo $response->getContent(); // {}



// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->sms->enviar('NUMERO-DESTINO', 'SUA MENSAGEM');

echo $response->getContent(); // {}
    


// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->tts->enviar('NUMERO-DESTINO', 'SUA MENSAGEM');

echo $response->getContent(); // {}
    


// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->audio->enviar('NUMERO-DESTINO', 'SUA MENSAGEM');

echo $response->getContent(); // {}



// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;
    
$client = new TotalVoiceClient('access-token');
$response = $client->central->buscaRamal('ID-RAMAL');

echo $response->getContent(); // {}
    


// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->conta->buscaConta('ID_CONTA');

echo $response->getContent(); // {}



// Considero que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;

$client = new TotalVoiceClient('access-token');
$response = $client->perfil->consultaSaldo();

echo $response->getContent(); // {}



// Consideramos que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;
use TotalVoice\Api\Chamada;

$client = new TotalVoiceClient('access-token');
$service = new Chamada($client);
$response = $service->ligar('NUMERO-A', 'NUMERO-B');

echo $response->getContent();



// Consideramos que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Api\Chamada;

class MeuClient implements ClientInterface 
{

}

$meuclient = new MeuClient('access-token');
$service = new Chamada($meuclient);
$response = $service->ligar('NUMERO-A', 'NUMERO-B');



// Consideramos que já existe um autoloader compatível com a PSR-4 registrado

use TotalVoice\Client as TotalVoiceClient;
use TotalVoice\Api\Chamada;

$client = new TotalVoiceClient('access-token', 'https://meuhost.com.br');
$service = new Chamada($client);
$response = $service->ligar('NUMERO-A', 'NUMERO-B');




use TotalVoice\Client as TotalVoiceClient;
use TotalVoice\Api\Chamada;

$client = new TotalVoiceClient('access-token');
$response = $client->did->listaEstoque();




use TotalVoice\Client as TotalVoiceClient;
use TotalVoice\Api\Chamada;

$client = new TotalVoiceClient('access-token');
$idDid = "10";
$response = $client->did->adquirir($idDid);




use TotalVoice\Client as TotalVoiceClient;
use TotalVoice\Api\Chamada;

$client = new TotalVoiceClient('access-token');
$didId = "11";
$uraId = null;
$response = $client->did->atualizar($idDid, $ramalId, $uraId);




use TotalVoice\Client as TotalVoiceClient;
use TotalVoice\Api\Chamada;

$client = new TotalVoiceClient('access-token');
$didId = "11";
$response = $client->did->excluir($didId);




use TotalVoice\Client as TotalVoiceClient;
use TotalVoice\Api\Chamada;

$client = new TotalVoiceClient('access-token');
$response = $client->did->lista();
composer
composer 
json
{
    "total-voice/php-client": "1.*"
}
composer
php composer.phar test