munafio / oursms-laravel
Laravel OurSMS API Integration
v0.1.0
2021-06-08 23:12 UTC
Requires
- guzzlehttp/guzzle: 7.4.x-dev
This package is auto-updated.
Last update: 2024-10-30 02:16:10 UTC
README
The Service Has STOPPED!
Laravel OurSMS API Integration
Installation
- Require the package into your Laravel application:
$ composer require munafio/oursms-laravel
- Install OurSMS using the following artisan command:
$ php artisan oursms:install
this will publish the configurations and create oursms
environment variables inside your application's .env
file and setups everything for you.
- Modify the following variables in your application's
.env
with your OurSMS Account's credentials:
...
OURSMS_USER_ID=
OURSMS_SECRET_KEY=
That's it, enjoy :)
Quick Start
you can easily use this package inside your application, all you need is to import package's facade
anywhere inside your application (e.g. inside the controllers) as the following:
use Munafio\OurSMS\Facades\OurSMS;
or, you can use it directly without importing the facade
as the following:
... public function example(Request $request){ ... OurSMS::sendOSM(...,...); ... } ...
Available Methods
Send One Single Message ( OSM )
OurSMS::sendOSM($phoneNumber, $message);
Send One Time Password ( OTP )
OurSMS::sendOTP($phoneNumber, $message);
Get Status for SMS
OurSMS::getStatus($messageId);
Configurations
You can find the configurations file at config/oursms.php
in your application, which contains the following properties:
/* |------------------------------------- | OurSMS service credentials |------------------------------------- */ 'user_id' => env('OURSMS_USER_ID', null), 'secret_key' => env('OURSMS_SECRET_KEY', null),
user_id
you own user id in the website.secret_key
your own secret key you can find it next to theuser id
in the website.
/* |------------------------------------- | OurSMS service API base_uri |------------------------------------- */ 'base_uri' => 'https://oursms.app/api/v1/SMS'
base_uri
is the base url ofOurSMS
service's endpoints.