1. Go to this page and download the library: Download texto/sdk 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/ */
texto / sdk example snippets
to = new Texto\Texto(getenv('TEXTO_API_KEY'));
$result = $texto->send('+61400000000', 'Hello from Texto');
echo $result['message_id'];
echo $texto->balance(), " credits remaining\n";
// Tip: out link (texto.au/xxxxxx, 15 chars, always shortened) — recommended
// for Sender ID sends, where recipients can't reply STOP.
$texto->sendBatch(
[
['to' => '+61400000000', 'name' => 'Ada'],
['to' => '+61400000001', 'name' => 'Grace'],
],
'Hi {name}, your appointment is tomorrow.'
);
use Texto\Exception\InsufficientCreditsException;
use Texto\Exception\ApiException;
try {
$texto->send('+61400000000', 'Hello');
} catch (InsufficientCreditsException $e) {
echo "Need {$e->creditsRequired()} credits, have {$e->creditsAvailable()}";
} catch (ApiException $e) {
echo "{$e->status}: {$e->getMessage()}";
}
use Texto\Webhooks;
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_TEXTO_SIGNATURE'] ?? null;
$event = Webhooks::parseEvent($payload, $signature, getenv('TEXTO_WEBHOOK_SECRET'));
if (Webhooks::isInboundEvent($event)) {
// handle the reply
}
$texto = new Texto\Texto(
apiKey: getenv('TEXTO_API_KEY'),
baseUrl: 'https://api.texto.com.au', // only change for a mock server or test proxy
timeout: 30.0,
maxRetries: 2
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.