1. Go to this page and download the library: Download amdadulhaq/bd-sms-laravel 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 AmdadulHaq\BdSms\Facades\Sms;
Sms::send('01700000000', 'Your OTP is 4242');
// Send the same message to several recipients.
$results = Sms::sendMany(['01700000000', '01800000000'], 'Scheduled maintenance tonight at 11pm.');
// ['01700000000' => true, '01800000000' => true]
// Check remaining prepaid balance, if the driver supports it.
Sms::balance();
// Use a specific driver, or a driver other than the default, for one call.
Sms::driver('sslwireless')->send('01700000000', 'Hello via SSL Wireless');
use AmdadulHaq\BdSms\Notifications\SmsChannel;
use Illuminate\Notifications\Notification;
class OrderShipped extends Notification
{
public function via(object $notifiable): array
{
return [SmsChannel::class];
}
public function toSms(object $notifiable): string
{
return "Your order #{$this->order->id} has shipped!";
}
}
public function routeNotificationForSms(Notification $notification): string
{
return $this->mobile_number;
}
use AmdadulHaq\BdSms\Facades\Sms;
use AmdadulHaq\BdSms\Contracts\SmsDriver;
Sms::extend('my-gateway', function ($app) {
return new MyGatewayDriver(/* ... */);
});
interface SmsDriver
{
public function send(string $to, string $message): bool;
public function balance(): ?float;
}
use AmdadulHaq\BdSms\Facades\Sms;
Sms::fake();
// ... code under test that calls Sms::send() or fires an "sms" notification ...
Sms::assertSent(fn (string $to, string $message) => $to === '01700000000' && str_contains($message, 'OTP'));
Sms::assertSentTo('01700000000');
Sms::assertSentCount(1);
Sms::assertNothingSent();
Sms::assertNotSent(fn (string $to) => $to === '01899999999');
bash
php artisan vendor:publish --tag=sms-config
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.