1. Go to this page and download the library: Download gosms-ge/sms-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 GoSmsGe\SmsSDK\Exception\ApiException;
use GoSmsGe\SmsSDK\Exception\InsufficientBalanceException;
use GoSmsGe\SmsSDK\Exception\InvalidPhoneException;
use GoSmsGe\SmsSDK\Exception\NetworkException;
try {
$client->sendSms('MYBRAND', '995555123456', 'Hello!');
} catch (InsufficientBalanceException $e) {
// Handle low balance
} catch (InvalidPhoneException $e) {
// Handle bad phone number
} catch (ApiException $e) {
// Catch-all for any API error
echo $e->getErrorCode(); // int (100-113)
echo $e->getErrorMessage(); // string
} catch (NetworkException $e) {
// Transport failure or invalid JSON response
}
use GoSmsGe\SmsSDK\Exception\TooManyRequestsException;
use GoSmsGe\SmsSDK\Exception\AccountLockedException;
try {
$response = $client->sendOtp('995555123456');
} catch (TooManyRequestsException $e) {
echo 'Too many attempts. Retry after ' . $e->getRetryAfter() . 's';
} catch (AccountLockedException $e) {
echo 'Account locked. Retry after ' . $e->getRetryAfter() . 's';
}
use GoSmsGe\SmsSDK\GoSmsClient;
use GuzzleHttp\Client as Guzzle;
$guzzle = new Guzzle(['timeout' => 10]);
$client = new GoSmsClient(
'your-api-key',
'https://api.gosms.ge',
$guzzle
);
$client = new GoSmsClient('your-api-key', 'https://your-custom-endpoint.com');
// In AppServiceProvider::register()
$this->app->singleton(GoSmsClient::class, function () {
return new GoSmsClient(config('services.gosms.api_key'));
});
// In your controller
public function send(GoSmsClient $gosms)
{
$gosms->sendSms('MYBRAND', $request->phone, 'Your code is 1234');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.