Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Notification Laravel Package

websms/laravel-notification

View on GitHub
Deep Wiki
Context7

websms-laravel-notification

WebSms Laravel Notification

Installation

You can install the package via composer:

$ composer require websms/laravel-notification

You must install the service provider:

// config/app.php
'providers' => [
    ...
    Websms\LaravelNotification\WebSmsServiceProvider::class,
]

Setting up your WebSms account

Add your WebSms Username, Password and Sender Number to your config/services.php:

// config/services.php

...
'websms' => [
'username' => env('WEBSMS_USERNAME'),
'password' => env('WEBSMS_PASSWORD'),
'sendNumber' => env('WEBSMS_SENDNUMBER'),
],
...
// .env

WEBSMS_USERNAME=your_username
WEBSMS_PASSWORD=your_password
WEBSMS_SENDNUMBER=send_number

Usage

Now you can use the channel in your via() method inside the notification:

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{
    return [WebSmsChannel::class];
}

/**
 * Get the sms representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return string
 */
public function toSms($notifiable)
{
    $webSmsMessage = new WebSmsMessage();
    $webSmsMessage->setFrom(env('WEBSMS_SENDNUMBER'));
    $webSmsMessage->setTo($notifiable->routeNotificationFor('sms'));
    $webSmsMessage->setMessage($this->message);

    return $webSmsMessage;
}

In order to let your Notification know which phone number you are sending to, add the routeNotificationForSms method to your Notifiable model e.g your User Model

public function routeNotificationForSms()
{
    return $this->phone; // where `phone` is a field in your users table;
}

Conterbuter

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky