2017 © Pedro Peláez
 

library sms-poh

SmsPoh Sdk for laravel

image

pyaesone17/sms-poh

SmsPoh Sdk for laravel

  • Saturday, January 13, 2018
  • by pyaesone17
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 38 % Grown

The README.md

SMS Poh LARAVEL SDK

https://smspoh.com/, (*1)

This is my personal library to make it easier for developers. This is not offical SDK for smspoh. The main goal to create this package is I hate curl , guzzle or etc .... And I made abstraction. Now I could use easily by calling like this. That is it., (*2)

``` php send_smspoh( ['+959790646062','+95943160544'], 'Nice to meet you' );, (*3)


## Install Via Composer ``` bash $ composer require pyaesone17/sms-poh:^1.1

Set Up

Publish the config file first. ``` bash $ php artisan vendor:publish, (*4)


Configure the token in the sms-poh.php config file.

'token' => env('SMS_POH_TOKEN', 'Your_token_from_the_dashboard'),, (*5)


## SDK Usage For fetching messages. 1. Using Facade ``` php $results = SmsPohFacade::fetch(1);

2.Using Container ``` php $sms = app()->make(pyaesone17\SmsPoh\SmsPoh::class); $results = $sms->fetch(1);, (*6)


3.Using function ``` php $resutls = fetch_smspoh(1);

For sending messages., (*7)

  1. Using Facade ``` php $results = SmsPohFacade::send( ['+959790646062','+95943160544'], 'Nice to meet you' );

$results = SmsPohFacade::send( '+959790646062', 'Nice to meet you' );, (*8)


2.Using Container ``` php $sms = app()->make(pyaesone17\SmsPoh\SmsPoh::class); $results = $sms->send( ['+959790646062','+95943160544'], 'Nice to meet you' );

3.Using function ``` php $results = send_smspoh( ['+959790646062','+95943160544'], 'Nice to meet you' );, (*9)


If you want to send message as testing purpose, you could pass true as a third parameter. ## Notification Channel Usage This package also include custom notification channel for interacting with Laravel Notification features. Here is how to use it. ``` php class SendSmsPohNotification extends Notification { use Queueable; public $message; /** * Create a new notification instance. * * @return void */ public function __construct($message) { $this->message = $message; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return [pyaesone17\SmsPoh\SmsPohChannel::class]; } /** * Get the sms representation of the notification. * * @param mixed $notifiable * @return array */ public function toMMSms($notifiable) { return [ 'message' => $this->message, 'to' => '+959790646062', 'test' => 1, 'callback' => function (...$result) { // After sms is being sent or failed // The callback will fire, here you can // do whatever you want with the result. // If you don't want, just pass as null dd($result); } ]; }

And Notify like this, (*10)

$user = App\User::first();
$user->notify(new App\Notifications\SendSmsPohNotification("Hello world"));

License

The MIT License (MIT). Please see License File for more information., (*11)

The Versions