1. Go to this page and download the library: Download variablesign/sms 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 VariableSign\Sms\Facades\Sms;
// Using the default gateway
$response = Sms::balance();
// With another gateway
$response = Sms::via('mnotify')->balance();
use VariableSign\Sms\Sms;
$response = (new Sms)->via('mnotify')->balance();
$response = sms()->via('mnotify')->balance();
250
use VariableSign\Sms\Facades\Sms;
// Using the default gateway
$response = Sms::to(['2332xxxxxxxx','2332xxxxxxxx'])
->message('Hi, we just want to thank you for using our service.')
->send();
// With another gateway
$response = Sms::via('arkesel')
->to(['2332xxxxxxxx','2332xxxxxxxx'])
->message('Hi, we just want to thank you for using our service.')
->send();
use VariableSign\Sms\Sms;
$response = (new Sms)->via('arkesel')
->to(['2332xxxxxxxx','2332xxxxxxxx'])
->message('Hi, we just want to thank you for using our service.')
->send();
$response = sms()->via('arkesel')
->to(['2332xxxxxxxx','2332xxxxxxxx'])
->message('Hi, we just want to thank you for using our service.')
->send();
[
{
"id": "c61ff669-4bb1-41c1-97ea-11658dedafbd",
"to": "2332xxxxxxxx",
"message": "Hi, we just want to thank you for using our service.",
"status": "submitted"
},
{
"id": "572ae33d-3983-47a0-a1ac-6fc3efafac4f",
"to": "2332xxxxxxxx",
"message": "Hi, we just want to thank you for using our service.",
"status": "submitted"
}
]
use VariableSign\Sms\Facades\Sms;
// Using the default gateway
$response = Sms::report('c61ff669-4bb1-41c1-97ea-11658dedafbd');
// With another gateway
$response = Sms::via('arkesel')->report('c61ff669-4bb1-41c1-97ea-11658dedafbd');
use VariableSign\Sms\Sms;
$response = (new Sms)->via('arkesel')->report('c61ff669-4bb1-41c1-97ea-11658dedafbd');
use VariableSign\Sms\Facades\Sms;
// Can also be initialized without facades or with the helper function
$response = Sms::via('arkesel')
->to(['+2332xxxxxxxx'])
->otp('Password Reset', now()->addMinutes(5)->addSecond());
[
{
"id": "4180e0a9-71cb-41e2-aafe-1cb69c1545ea",
"to": "2332xxxxxxxx",
"message": "Your Password Reset OTP is 9826. It expires in 5 minutes.",
"status": "submitted",
"otp": "9826",
"expires_at": "2022-06-08T20:00:53.000000Z"
}
]
use VariableSign\Sms\Facades\Sms;
// Can also be initialized without facades or with the helper function
$response = Sms::via('arkesel')->to(['+2332xxxxxxxx'])->otp('Password Reset');
use VariableSign\Sms\Facades\Sms;
// Can also be initialized without facades or with the helper function
$response = Sms::via('arkesel')
->to(['+2332xxxxxxxx'])
->message('Your phone number verification code is :code.')
->otp(null, now()->addMinutes(5)->addSecond(), 6);
[
{
"id": "e1ee89b2-05c7-454a-bf52-3ffe243aee1b",
"to": "2332xxxxxxxx",
"message": "Your phone number verification code is 803501. It expires in 5 minutes.",
"status": "submitted",
"otp": "803501",
"expires_at": "2022-06-08T19:49:36.000000Z"
}
]
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use VariableSign\Sms\Channels\SmsChannel;
use Illuminate\Notifications\Notification;
class PaymentNotification extends Notification
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['sms']; // or SmsChannel::class
}
/**
* Get the sms representation of the notification.
*
* @param mixed $notifiable
* @return \VariableSign\Sms\Sms
*/
public function toSms($notifiable)
{
return sms()
->via('smsonlinegh') // optional
->to($notifiable->phone)
->message('Your payment of 750.00 for order #10045 was successful.');
}
}
$user->notify(new PaymentNotification);
use VariableSign\Sms\Facades\Sms;
// Returns the unformatted response from the api endpoint
$response = Sms::dd()->via('usmsgh')->balance();