SMS service provider for Laravel

Overview

laravel-sms

Build Status

SMS service provider for Laravel and Lumen. Uses SMS Client to enable sending SMS messages using the following drivers:

  • nexmo
  • clockwork
  • textlocal
  • twilio
  • aws (requires installation of aws/aws-sdk-php)
  • mail (somewhat untested and may be too generic to be much use)

Also has the following drivers for testing purposes:

  • log
  • null
  • requestbin

Installation for Laravel

This package is only intended for Laravel 5.5 and up. Install it with the following command:

$ composer require matthewbdaly/laravel-sms

Then publish the config file:

$ php artisan vendor:publish

You will need to select the service provider Matthewbdaly\LaravelSMS\LaravelSMSProvider. Then set your driver and any settings required in the .env file for your project:

SMS_DRIVER=nexmo
NEXMO_API_KEY=foo
NEXMO_API_SECRET=bar
CLOCKWORK_API_KEY=baz
TEXTLOCAL_API_KEY=baz
REQUESTBIN_PATH=foo
AWS_SNS_API_KEY=foo
AWS_SNS_API_SECRET=bar
AWS_SNS_API_REGION=baz
MAIL_SMS_DOMAIN=my.sms-gateway.com
TWILIO_ACCOUNT_ID=foo
TWILIO_API_TOKEN=bar

Installation for Lumen

The installation process with Lumen is identical to that for Laravel, although if you wish to use the facade you will need to uncomment the appropriate section of bootstrap/app.php as usual.

Usage

Once the package is installed and configured, you can use the facade to send SMS messages:

use SMS;

$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
SMS::send($msg);

Or fetch it from the app:

$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$sms = app()['sms']
$sms->send($msg);

Or resolve the interface Matthewbdaly\SMS\Contracts\Client:

$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$sms = app()->make('Matthewbdaly\SMS\Contracts\Client');
$sms->send($msg);

Here we use the app() helper, but you'll normally want to inject it into a constructor or method of another class.

You might also like...
A package for verifying a user via call or SMS

Verify your users by call or SMS It's a common practice: a user signs up, you send an SMS to their phone with a code, they enter that code in your app

ApnsPHP: Apple Push Notification & Feedback Provider
ApnsPHP: Apple Push Notification & Feedback Provider

ApnsPHP: Apple Push Notification & Feedback Provider A full set of open source PHP classes to interact with the Apple Push Notification service for th

Service that helps you to send notifications for a series of failed exceptions.

Laravel Failure Notifier This package helps you to track your exceptions and do what you want to do with them such as sending an SMS or and Email. You

Bugsnag notifier for the Laravel PHP framework. Monitor and report Laravel errors.

The Bugsnag Notifier for Laravel gives you instant notification of errors and exceptions in your Laravel PHP applications. We support both Laravel and Lumen. Learn more about Laravel error reporting from Bugsnag.

Multiple channels of laravel exception notification(DingTalk、FeiShu、ServerChan、WeWork、XiZhi). - 多种通道的 laravel 异常通知(钉钉群机器人、飞书群机器人、Server 酱、企业微信群机器人、息知)。
Multiple channels of laravel exception notification(DingTalk、FeiShu、ServerChan、WeWork、XiZhi). - 多种通道的 laravel 异常通知(钉钉群机器人、飞书群机器人、Server 酱、企业微信群机器人、息知)。

laravel-exception-notify 简体中文 | ENGLISH Multiple channels of laravel exception notification(DingTalk、FeiShu、ServerChan、WeWork、XiZhi). - 多种通道的 laravel

Code execution monitoring for Laravel applications.

Inspector | Code Execution Monitoring Tool Simple code execution monitoring, built for Laravel developers. Requirements Install Configure the Ingestio

 Google Chat - Laravel Notification Channel
Google Chat - Laravel Notification Channel

Google Chat - Laravel Notification Channel This package makes it easy to send notifications using Google Chat , (formerly known as Hangouts Chat) with

Laravel Security Notifications

This package adds security notifications to warn your users when significant security events occur so that they aren't the next victim of an attacker.

Laravel package to launch toast notifications.
Laravel package to launch toast notifications.

Laravel package to launch toast notifications. This package provides assistance when using toast notifications. Using the iziTOAST package, which allo

Comments
  • AWS Sender ID

    AWS Sender ID

    in array 'SenderID' => $message['from'] replace to 'MessageAttributes' => [ 'AWS.SNS.SMS.SenderID' => [ 'DataType' => 'String', 'StringValue' => $message['from'] ] ]

    opened by geek1981 2
  • sendRequest function always return false for all drivers

    sendRequest function always return false for all drivers

    any request always return false for all drivers because there is if condition to check if status code = 201 while it returns 200

    return $response->getStatusCode() == 201;
    

    screenshot from 2018-06-14 12-06-11

    opened by mshifo 1
Owner
Matthew Daly
I'm a web developer in Norfolk. I use Python, PHP and JavaScript.
Matthew Daly
Implementations for different SMS providers for EspoCRM. Can be used for 2-factor authentication or automatic SMS sending via Workflow and BPM tools.

SMS Providers for EspoCRM An installable extension. Supported SMS Providers Twilio Spryng sms77 Setting up Install the extension. At Administration >

EspoCRM - Open Source CRM 11 Nov 30, 2022
@Authy notification channel for @Laravel, with the ability to send in-app, sms, and call verification tokens.

Authy Notification Channel for Laravel Authy notification channel for Laravel, with the ability to send in-app, sms, and call verification tokens. Tab

Laravel Notification Channels 57 Dec 19, 2022
Laravel SMS Notification Channel

Laravel SMS Notification Channel Installation composer require guangda/laravel-sms-notification-channel env 配置 SMS_PROVIDER=yunpian SMS_SIGNATURE=【签名

Guangda 6 Dec 29, 2021
laravel send sms. kavenegar, ghasedak

Requirements laravel >= 7 Installation composer require ehsanmoradi/laravel-sms Publish the configuration file (this will create a laravel-sms.php

ehsan moradi 3 Feb 6, 2022
An SMS notification channel for the PHP framework Laravel.

Laravel SMS notification channel An SMS notification channel for the PHP framework Laravel. Supported SMS gateways: 46elks Cellsynt Telenor SMS Pro Tw

Andreas 2 Jan 22, 2022
Sends notifications via one or more channels (email, SMS, ...).

Notifier Component The Notifier component sends notifications via one or more channels (email, SMS, ...). Resources Documentation Contributing Report

Symfony 610 Jan 3, 2023
Fake SMS (as email during development) Notifier Bridge

Fake SMS Notifier Provides Fake SMS (as email during development) integration for Symfony Notifier. DSN example FAKE_SMS_DSN=fakesms+email://default?t

Symfony 17 May 23, 2022
Provides Turbo SMS integration for Symfony Notifier.

TurboSms Notifier Provides TurboSms integration for Symfony Notifier. DSN example TURBOSMS_DSN=turbosms://AUTH_TOKEN@default?from=FROM where: AUTH_TO

Symfony 5 May 23, 2022
all geteways (SMS&Payments geteways) By (Mahmoud Ibrahim)

All gateways payments & SMS package name: gateways package version: v1.1 author : mahmoud ibrahim description :provide gateways payments and SMS to in

php anonymous 24 Dec 26, 2022
Send SMS with easy using BEEM

beem-sms-api Send SMS with easy using BEEM Installation You must be using composer to be able to use this library. If composer 1.x is installed, make

Hosanna Higher Technologies 4 Dec 24, 2021