1. Go to this page and download the library: Download x3group-dev/calltouch 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/ */
x3group-dev / calltouch example snippets
injectablephp
use Throwable;
use X3Group\CallTouch\Result\ResultInterface;
use X3Group\CallTouch\Helpers\ExceptionHelper;
use X3Group\CallTouch\Reporters\ReportedInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\RequestInterface;
class EmailReporter implements ReportedInterface
{
private ?ResponseInterface $response = null;
private ?RequestInterface $request = null;
private ?ResultInterface $result = null;
public function report(): void
{
if (null === $this->response) {
return;
}
$responseBody = $this->response->getBody();
$responseBody->rewind();
$message = $responseBody->getContents() ?: 'Unknown error';
mail('[email protected]', 'Subject', $message);
}
public function setResponse(ResponseInterface $response): self
{
$this->response = $response;
return $this;
}
public function setRequest(RequestInterface $request): self
{
$this->request = $request;
return $this;
}
public function setResultValidate(ResultInterface $result): self
{
$this->result = $result;
return $this;
}
}