huangdijia/laravel-sms

sms for laravel

1.1.7 2020-11-24 10:13 UTC

This package is auto-updated.

Last update: 2024-06-24 17:26:38 UTC


README

Laravel-sms

Latest Stable Version Total Downloads GitHub license

Installation

Install package

composer require huangdijia/laravel-sms

Install configure

php artisan sms:install

Uage

Simple to send a message

use Huangdijia\Sms\Facades\Sms;

Sms::to('phone number')->content('message content')->send();

Check send result

$response = Sms::to('phone number')->content('message content')->send();

if ($response->successful()) {
    // success
}

Throwing Exceptions

$response = Sms::to('phone number')->content('message content')->send();

$response->throw();

Switch sms factory

Sms::use('another')->to('phone number')->content('message content')->send();

With Validate Rules

Sms::withRules([
    'to'      => 'required|numeric|....',
    'content' => 'required|...',
], [
    'to.required'      => ':attribute cannot be empty!',
    'content.required' => ':attribute cannot be empty!',
    // more messages
])->to()->content()->send();