1. Go to this page and download the library: Download kavenegar/php 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/ */
kavenegar / php example snippets
use Kavenegar\KavenegarApi;
use Kavenegar\Exceptions\ApiException;
use Kavenegar\Exceptions\HttpException;
$api = new KavenegarApi("YOUR_API_KEY");
try {
// Send a simple SMS
$result = $api->send("10004346", "09123456789", "Hello from Kavenegar PHP SDK!");
foreach ($result as $sms) {
echo "✅ Sent! Message ID: " . $sms->messageid . "\n";
}
} catch (ApiException $e) {
echo "❌ API Error: " . $e->errorMessage() . "\n";
} catch (HttpException $e) {
echo "❌ Network Error: " . $e->errorMessage() . "\n";
}