clean-code-studio / laravel-text-messages
Laravel SMS and MMS Package for Sending Text Messages To Users Without needing a 3rd party API
dev-master
2019-01-22 17:24 UTC
Requires
- php: ^7.1.3
This package is auto-updated.
Last update: 2024-10-23 06:17:24 UTC
README
Laravel Package To Send Text Messages To Major Phone Providers For Free
Installation
composer require clean-code-studio/laravel-text-messages
php artisan vendor:publish
choose to publish this package
php artisan migrate
use CleanCodeStudio\LaravelTextMessages\Textable Trait on any model you want to text
Using Textable trait on User Model
use CleanCodeStudio\LaravelTextMessages\Textable;
class User extends Authenticatable
{
use Textable;
//...
#####Example Usage:
$user = App\User::create(['email' => 'test@example.com', 'password' => 'secret', 'name' => 'johnDoe']);
// register phone number to user
$user->isTextableVia('Sprint')->at('5555555555');
// then send a text message to the user
$user->text()->message('hello world');
Customization
Set sender address of text message :
- Go to
config/textable.php
- Set the
from
property *Example: *config/textable.php
<?php
return [
//define who the text message sender address is
'from' => 'text.from@your.app',
];
Supported Cell Phone Providers
All Options Defined In: config/gateway.php
'options' => [
'AT&T',
'Sprint',
'Cricket',
'Verizon',
'T-Mobile',
'US Cellular',
'Boost Mobile',
'Virgin Mobile'
];
Supported Gateways
pms
sms
Sending Custom Text Messages With Laravel Mailable Objects
$user = App\User::create(['email' => 'test@example.com', 'password' => 'secret', 'name' => 'johnDoe']);
// register phone number to user
$user->isTextableVia('Virgin Mobile')->at('5555555555');
// Send a message with a custom mailable instance
$user->text()->message(new MailableInstance($info));