Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
/ oursms-laravel Public archive

oursms.app client library that allows you to send SMS

Notifications You must be signed in to change notification settings

khalidsheet/oursms-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oursms laravel client

Codacy Badge

https://oursms.app client library that allows you to send SMS

Installation

Install oursms client with composer

  composer require khalidsheet/oursms

Skip this if you are running laravel version 5.5 or later The package will be auto-discovered

Otherwise run this command

Step 1 - Publish the package config file under config/oursms.php

  php artisan vendor:publish --provider="Khalidsheet\Oursms\OursmsServiceProvider" --tag="config"

Step 2 - Go to the application .env and paste these variables in the end of the file.

OURSMS_USER_ID=""
OURSMS_KEY=""

Usage/Examples

Import the package

use Khalidsheet\Oursms\Oursms

In your controller instantiate a new instance from Oursms Client

$oursmsClient = new Oursms();

If you wish to send a single message

$oursmsClient->sendMessage(string $to, string $message);

If you wish to send Otp message

$oursmsClient->sendOtp(string $to, string $otp);

If you wish to check the status of your message

$oursmsClient->getSmsStatus(string $messageId);

Notice: to is the phone number, message is the actuall mesasge that will be send to the user.

Trait Usage/Examples

Also, you can use trait to send SMS or OTP messages to a user

Add the Messageable trait to your model.

use Khalidsheet\Oursms\Traits\Messageable;

class User extends Model {
     use Messageable;

     ...
}

Now you can use it like this

$user = User::find(1);

// Sending OSM 
$user->sendMessage(string $message);

// Sending OTP
$user->sendOtp(string $otp);

Notice: Trait functionality only available from version 1.1.0 or later

Authors

License

MIT

About

oursms.app client library that allows you to send SMS

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages