eeappdev/svevesms

Sveve SMS API handler

0.0.3 2023-05-01 15:49 UTC

This package is auto-updated.

Last update: 2024-11-30 01:57:58 UTC


README

Latest Version on Packagist Total Downloads

Used to send SMS thru Sveve API

// Send an SMS thru the API
use Eeappdev\SveveSms\Sms;
$sms = new Sms();
$sms->to($phonenumber)
    ->message('Content of the message')
    ->send();

Installation

You can install the package via composer:

composer require eeappdev/svevesms

Publish the config if wanted:

php artisan vendor:publish --provider="Eeappdev\SveveSms\SmsServiceProvider" --tag="config"

Add credentials in your .env file:

SVEVE_USER=
SVEVE_PASSWORD=
SVEVE_URL="https://sveve.no/SMS/"
SVEVE_FROM=

Usage

use Eeappdev\SveveSms;

$sms = new Sms();

$sms->to($phonenumber)
    ->from() // set from, if not set, it will come from config
    ->message() // Write your message
    ->test(true) // Will not send the SMS
    ->send(); // Sending the request

Send same message to many recipients

$sms = new Sms();
$sms->to([
        '12345678', 
        '23456789'
    ])
    ->message('This message will be sent to both recipients') // Write your message
    ->send(); // Sending the request

Send same message to many recipients

$sms = new Sms();
$sms->to(12345678)
    ->to(23456789)
    ->message('This message will be sent to both recipients')
    ->send(); // Sending the request

Send different messages, to different recipients

$sms = new Sms();
$sms->to(12345678)
    ->message('This message will be sent to first recipient')
    ->to(23456789)
    ->message('This message will be sent to second recipient')
    ->send(); // Sending the request

Check remaining SMS

$sms = new Sms();
$sms->remainingSms(); // Return null or int

License

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