Giter Site home page Giter Site logo

sms-poh's Introduction

SMS Poh LARAVEL SDK

https://smspoh.com/

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.

send_smspoh(
    ['+959790646062','+95943160544'],
    'Nice to meet you'
);

Install

Via Composer

$ composer require pyaesone17/sms-poh:^1.1

Set Up

Publish the config file first.

$ php artisan vendor:publish

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

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

SDK Usage

For fetching messages.

  1. Using Facade
$results = SmsPohFacade::fetch(1);

2.Using Container

$sms = app()->make(pyaesone17\SmsPoh\SmsPoh::class);
$results = $sms->fetch(1);

3.Using function

$resutls = fetch_smspoh(1);

For sending messages.

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

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

2.Using Container

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

3.Using function

$results = send_smspoh(
    ['+959790646062','+95943160544'],
    'Nice to meet you'
);

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.

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

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

License

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

sms-poh's People

Contributors

nyanwin avatar pyaesone17 avatar

Stargazers

Aung Si Min avatar Zin Myo Maung avatar Thet Paing Hein avatar Min Thu Kyaw avatar Lin Maung avatar Ye Yint avatar Htun Myint Winn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.