1. Go to this page and download the library: Download voicetel/voiceml 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/ */
use VoiceML\Client;
$client = new Client(
accountSid: 'AC…',
apiKey: '…',
);
$health = $client->diagnostics->health(); // uses your AccountSid + key on every call
$client = new VoiceML\Client(accountSid: $sid, authToken: $token);
use VoiceML\Client;
use VoiceML\Model\CreateCallRequest;
use VoiceML\Model\StartPaymentRequest;
$client = new Client(accountSid: 'AC…', apiKey: '…');
$call = $client->calls->create(new CreateCallRequest(
to: '+18005551234',
from: '+18005550000',
url: 'https://example.com/twiml',
));
// On a live call, open a Pay session:
$session = $client->calls->startPayment($call->sid, new StartPaymentRequest(
idempotencyKey: 'order-482917',
statusCallback: 'https://example.com/pay-status',
));
echo $session->sid, ' ', $session->status, PHP_EOL;