PHP code example of nikajorjika / laravel-sms-office
1. Go to this page and download the library: Download nikajorjika/laravel-sms-office 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/ */
nikajorjika / laravel-sms-office example snippets
return [
/**
* Endpoint for sms office url
*/
'api_url' => env('SMS_OFFICE_URL', 'http://smsoffice.ge/api/v2/send/'),
/**
* Private Key provided by sms office service
*/
'key' => env('SMS_OFFICE_KEY', null),
/**
* Driver that serves as a channel driver for laravel
*/
'driver' => env('SMS_OFFICE_DRIVER', 'sms-office'),
/**
* This key defines sender name
* for the sms to be delivered from
*/
'from' => env('SMS_OFFICE_FROM', NULL),
/**
* List of drivers that sms office package supports
*/
'supported_drivers' => ['sms-office', 'log'],
/**
* Define no sms code for the user to unsubscribe
*/
'no_sms_code' => env('SMS_OFFICE_NOSMS', NULL),
];
// Basic Usage
...
use Nikajorjika\SmsOffice\Facades\SmsOffice;
$phoneNumber = '855737812'; // It could also be 995855737812
$message = 'You have found your package ;).';
SmsOffice::message($message)->to($phoneNumber)->send();
...
use Nikajorjika\SmsOffice\SmsOfficeChannel;
class FooBarNotification extends Notification implements ShouldQueue
{
use Queueable;
...
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [SmsOfficeChannel::class];
}
/**
* Return message to send via SmsOffice Channel
*
* @param mixed $notifiable
* @return string $message
*/
public function toSms($notifiable)
{
return 'You have found your package ;).';
}
...
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use Notifiable;
/**
* Get phone number from notifiable model
*
* @return string
*/
public function routeNotificationForSms()
{
return $this->full_phone_number;
}