PHP code example of wearesho-team / phonet

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

    

wearesho-team / phonet example snippets




use Wearesho\Phonet;

$client = new \GuzzleHttp\Client();
$provider = new Phonet\Authorization\Provider($client);



use Wearesho\Phonet;

/** @var Phonet\Authorization\ProviderInterface $provider */

$client = new \GuzzleHttp\Client();
$config = new Phonet\EnvironmentConfig();

$sender = new Phonet\Sender(
    $client,
    $config,
    $provider
);




use Wearesho\Phonet;

/** @var Phonet\Sender $sender */

$service = new Phonet\Service($sender);

$uuid = $service->makeCall(
    $operatorInternalNumber = '001', // Internal number of operator
    $callTakerNumber = '380000000002' // Phone number of target
);



use Wearesho\Phonet;

/** @var Phonet\Sender $sender */

$service = new Phonet\Service($sender);

$service->hangupCall(
    $uuid = 'uuid'
);



use Wearesho\Phonet;

/** @var Phonet\Sender $sender */

$repository = new Phonet\Repository($sender);

$activeCalls = $repository->activeCalls();



use Wearesho\Phonet;

/** @var Phonet\Sender $sender */

$repository = new Phonet\Repository($sender);

$missedCalls = $repository->missedCalls(
    $from = new DateTime(),
    $to = new DateTime(),
    $directions = new Phonet\Call\Direction\Collection([/** @see Phonet\Call\Direction */]),
    $limit = 10, // count of needs calls
    $offset = 5 // shift in sample
);



use Wearesho\Phonet;

/** @var Phonet\Sender $sender */

$repository = new Phonet\Repository($sender);

$companyCalls = $repository->companyCalls(
    $from = new DateTime(),
    $to = new DateTime(),
    $directions = new Phonet\Call\Direction\Collection([/** @see Phonet\Call\Direction */]),
    $limit = 10, // count of needs calls
    $offset = 5 // shift in sample
);



use Wearesho\Phonet;

/** @var Phonet\Sender $sender */

$repository = new Phonet\Repository($sender);

$usersCalls = $repository->usersCalls(
    $from = new DateTime(),
    $to = new DateTime(),
    $directions = new Phonet\Call\Direction\Collection([/** @see Phonet\Call\Direction */]),
    $limit = 10, // count of needs calls
    $offset = 5 // shift in sample
);



use Wearesho\Phonet;

/** @var Phonet\Sender $sender */

$repository = new Phonet\Repository($sender);

$users = $repository->users();