You can receive original docs on phonet site
composer require wearesho-team/phonet
Exist two implementation of configurations:
- Config - custom config
- EnvironmentConfig - based on Horatius\Environment\Config
Available environment variables:
variable | required | description |
---|---|---|
PHONET_DOMAIN | Yes | Domain name of your cms\system |
PHONET_API_KEY | Yes | Special api key that ypu can receive in your Phonet account |
Use ConfigInterface to create your custom config
To use Phonet api you must authorize to service. For this exist Authorization\ProviderInterface
<?php
use Wearesho\Phonet;
$client = new \GuzzleHttp\Client();
$provider = new Phonet\Authorization\Provider($client);
If You want cache your auth data use CacheProvider;
All api methods used Sender
<?php
use Wearesho\Phonet;
/** @var Phonet\Authorization\ProviderInterface $provider */
$client = new \GuzzleHttp\Client();
$config = new Phonet\EnvironmentConfig();
$sender = new Phonet\Sender(
$client,
$config,
$provider
);
Start new call and return unique uuid of it.
<?php
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
);
End a call / conversation by unique uuid
<?php
use Wearesho\Phonet;
/** @var Phonet\Sender $sender */
$service = new Phonet\Service($sender);
$service->hangupCall(
$uuid = 'uuid'
);
Repository contains methods for searching data in Phonet Service.
param | value |
---|---|
Return type | Call\Active\Collection |
Arguments | - |
Returns collection of calls that currently taking place.
<?php
use Wearesho\Phonet;
/** @var Phonet\Sender $sender */
$repository = new Phonet\Repository($sender);
$activeCalls = $repository->activeCalls();
param | value |
---|---|
Return type | Call\Complete\Collection |
Arguments | $from, $to, $directions, $limit, $offset |
Returns a collection of calls to call back.
<?php
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
);
param | value |
---|---|
Return type | Call\Complete\Collection |
Arguments | $from, $to, $directions, $limit, $offset |
Returns a collection of calls made by the company.
<?php
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
);
param | value |
---|---|
Return type | Call\Complete\Collection |
Arguments | $from, $to, $directions, $limit, $offset |
Returns a collection of calls made by employees.
<?php
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
);
param | value |
---|---|
Return type | Employee\Collection |
Arguments | - |
Returns a collection of employees of company.
<?php
use Wearesho\Phonet;
/** @var Phonet\Sender $sender */
$repository = new Phonet\Repository($sender);
$users = $repository->users();