1. Go to this page and download the library: Download iletiniz/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/ */
use Iletiniz\Exception\IletinizAPIError;
use Iletiniz\Exception\IletinizAuthenticationError;
use Iletiniz\Exception\IletinizConnectionError;
use Iletiniz\Exception\IletinizNotFoundError;
use Iletiniz\Exception\IletinizRateLimitError;
use Iletiniz\Exception\IletinizServerError;
use Iletiniz\Exception\IletinizTimeoutError;
use Iletiniz\Exception\IletinizValidationError;
try {
$client->messages->send(['to' => '+905551234567', 'body' => 'test']);
} catch (IletinizAuthenticationError $e) {
// 401 — geçersiz veya iptal edilmiş anahtar
} catch (IletinizValidationError $e) {
// 400 / 422 — istek doğrulanamadı
var_dump($e->getBody());
} catch (IletinizRateLimitError $e) {
// 429 — yeniden denemeden önce backoff
} catch (IletinizNotFoundError $e) {
// 404
} catch (IletinizServerError $e) {
// 5xx
} catch (IletinizAPIError $e) {
error_log(sprintf('%d %s %s [%s]', $e->status, $e->getApiCode() ?? '-', $e->getMessage(), $e->getRequestId() ?? '-'));
} catch (IletinizTimeoutError $e) {
// istek timeout'a takıldı
} catch (IletinizConnectionError $e) {
// ağ hatası
}
use Iletiniz\RequestOptions;
$client->messages->send(
['to' => '+905551234567', 'body' => 'merhaba'],
new RequestOptions(timeoutMs: 10000),
);
use Iletiniz\Http\HttpResponse;
use Iletiniz\Http\TransportInterface;
use Iletiniz\IletinizClient;
$transport = new class implements TransportInterface {
public function send(string $method, string $url, array $headers, ?string $body, int $timeoutMs): HttpResponse
{
return new HttpResponse(200, '{"ok":true,"db":"up"}', []);
}
};
$client = new IletinizClient([
'apiKey' => 'iltz_test_xxx',
'transport' => $transport,
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.