Download the PHP package rayzenai/laravel-sms without Composer

On this page you can find all versions of the php package rayzenai/laravel-sms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-sms

Laravel SMS

A comprehensive Laravel package for sending SMS messages through various providers with Filament admin panel integration.

Features

Requirements

Installation

You can install the package via composer:

Configuration

Step 1: Publish Configuration

Publish the configuration file:

This will publish a laravel-sms.php configuration file to your config directory.

Step 2: Run Migrations

Run the migrations to create the necessary database tables:

Step 3: Configure Environment Variables

Add the following variables to your .env file:

Selecting a provider is just SMS_PROVIDER=<name>. The name maps to an entry in the providers array of config/laravel-sms.php. You can also switch per message at runtime with Sms::provider('aakash')->send(...).

Step 4: Configure User Model Integration (Optional)

If you want to enable sending SMS to users from your database, update the config file:

Usage

Phone Number Validation

The package now supports validation for Nepali phone numbers:

Example Validation Rule:

Basic Usage

Sending a Single SMS

Sending Bulk SMS

Sending to a User (or any Model)

Implement the HasSmsNumber contract and add the Smsable trait. The model decides how its number is derived — a column, an accessor, concatenating a country code, or returning null when the record can't be reached. No config, no assumptions about your schema.

Then send with the model itself:

Choosing a Provider at Runtime

The active provider comes from SMS_PROVIDER, but you can override it per message without touching config:

Checking Provider Balance / Credit

Providers that support it (e.g. AakashSMS) implement ReportsBalance. Ask the active provider — or a specific one — for its remaining credit:

Calling balance() on a provider that doesn't support it throws an UnsupportedFeatureException.

Using in Controllers

API Endpoints

The package provides the following API endpoints. They spend real SMS credits, so they require authentication. Both are registered behind config('laravel-sms.routes.middleware'), which defaults to:

Publish the config to swap the guard for whichever one your application uses — but keep an auth guard and a rate limiter in the list. If your application only ever sends through the Sms facade, drop the endpoints entirely:

Requests that fail are logged via report(); the response body carries only a generic message, so provider errors are not exposed to the caller.

Send Single SMS

Endpoint: POST /api/sms/send

Request Body:

Response:

Send Bulk SMS

Endpoint: POST /api/sms/send-bulk

Request Body:

Response:

Filament Integration

Step-by-Step Filament Setup

1. Install Filament (if not already installed)

2. Register the SMS Plugin

In Filament v5, you'll need to register the LaravelSmsPlugin in your Panel service provider:

3. Access the SMS Management

Once you have registered the plugin (or the SentMessageResource directly), you will see SMS Management → Sent Messages in the admin panel navigation.

  1. Navigate to your Filament admin panel (typically /admin)
  2. Open Sent Messages under SMS Management to browse/filter the log.
  3. Click Send SMS (the resource's create button) to compose and send.

Sending lives on the resource's create screen — creating a "sent message" is sending one. There is no separate page to register. With Filament Shield, access is gated by the resource's Create permission (composing/sending) and ViewAny/View (reading the log) — no bespoke page permission needed.

Filament Features:

Send SMS (the "create" screen):

Sent Messages list/view:

Customizing Filament Resources

If you need to customize the Filament resources, you can publish them:

Then modify the published resources in app/Filament/Resources/SentMessageResource.php.

Advanced Configuration

Providers Registry

Every provider is registered by name in config/laravel-sms.php. Each entry names the class and carries that provider's own credentials. SMS_PROVIDER selects which one is active by default.

The manager instantiates the active provider and injects its config array (plus the shared timeout and default_sender). Adding a provider is just a class plus an entry here — see Creating Custom SMS Providers.

Rate Limiting

Rate limiting is enabled by default. Configure it in your .env:

Logging

All SMS activities are logged when enabled:

You can create a custom log channel in config/logging.php:

Creating Custom SMS Providers

Adding a provider takes two steps: write a class and register it. That's the whole extension surface.

1. Write the provider

Extend AbstractSmsProvider and implement send(). You get the shared $config, $timeout, and $sender, plus a default sendBulk() that loops send() — so a simple provider only implements one method.

2. Register it

Then set SMS_PROVIDER=custom (or use Sms::provider('custom') per message).

Testing

Credits

License

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


All versions of laravel-sms with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0|^13.0
filament/filament Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rayzenai/laravel-sms contains the following files

Loading the files please wait ...