ATTENTION THIS SDK IS STILL UNDER DEVELOPMENT. PLEASE SEE THE COVERAGE SECTION.
Here you'll find documentation related to the Sinch php SDK, including how to install it, initialize it, and start developing PHP code using Sinch services.
To use Sinch services, you'll need a Sinch account and access keys. You can sign up for an account and create access keys at dashboard.sinch.com.
For more information on the Sinch APIs on which this SDK is based, refer to the official developer documentation portal.
ATTENTION THIS SDK IS STILL UNDER DEVELOPMENT. PLEASE SEE THE COVERAGE SECTION.
PHP 8.1 and later.
To install the package via Composer, run the following command:
composer require sinch/sinch-sdk-phpDownload the files and include autoload.php:
<?php
require_once('/path/to/vendor/autoload.php');Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// init
$config = Sinch\Configuration::getDefaultConfiguration(("PROJECT_ID", "CLIENT_ID", "CLIENT_SECRET", "REGION"));
$sms = new Sinch\Sms\Batches(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
client: new GuzzleHttp\Client(),
config: $config
);
try {
$result = $sms->Batches->Send(data)();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ', $e->getMessage(), PHP_EOL;
}