PHP code example of rupeshdahal / nepali-sms-gateway
1. Go to this page and download the library: Download rupeshdahal/nepali-sms-gateway 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/ */
rupeshdahal / nepali-sms-gateway example snippets
use RupeshDai\NepaliSmsGateway\Facades\Sms;
// Send a single SMS
$result = Sms::send('9801234567', 'Your message here');
// Send SMS to multiple recipients
$result = Sms::sendMultiple(['9801234567', '9809876543'], 'Your message here');
// Check balance
$balance = Sms::checkBalance();
// Override sender ID for this message
$result = Sms::send('9801234567', 'Your message here', [
'from' => 'CUSTOM'
]);
use RupeshDai\NepaliSmsGateway\Exceptions\SmsException;
try {
$result = Sms::send('9801234567', 'Your message');
if ($result['success']) {
// Message sent successfully
} else {
// Message failed to send
// $result['error'] contains the error message
}
} catch (SmsException $e) {
// Handle exceptions
echo $e->getMessage();
}
// Create your gateway class in YourApp\Sms\Gateways\NewGateway.php
namespace YourApp\Sms\Gateways;
use RupeshDai\NepaliSmsGateway\Contracts\SmsGatewayInterface;
class NewGateway implements SmsGatewayInterface
{
// Implement the eways.new-gateway']);
});
return $manager;
});