Download the PHP package gr8shivam/laravel-sms-api without Composer

On this page you can find all versions of the php package gr8shivam/laravel-sms-api. 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-api

Packagist Packagist License Laravel PHP

Laravel SMS API

A modern, flexible Laravel package for integrating any SMS gateway that provides a REST API. Perfect for Laravel 10+ applications with full support for notifications, multiple gateways, and modern authentication methods.

โญ Star this repo to show support!


๐Ÿ“‹ Table of Contents


โœจ Features


๐Ÿ“Œ Requirements


๐Ÿ“ฆ Installation

1. Install via Composer

2. Publish Configuration

This creates config/sms-api.php in your application.

3. Configure Your Gateway

Edit config/sms-api.php and add your SMS provider credentials (see Configuration below).


๐Ÿš€ Quick Start

Send Your First SMS

Send to Multiple Recipients

Get Response


โš™๏ธ Configuration

Open config/sms-api.php after publishing.

Global Settings


Basic Gateway Configuration

For simple GET/POST requests:


Advanced Gateway Configuration

For JSON requests with complex structures:

Result payload example:


Authentication Methods

1. Bearer Token (Most Modern APIs)

In .env:

2. API Key in Header

3. Basic Authentication

4. API Key in Parameters


Special Parameters

json (boolean)

Send parameters as JSON payload instead of query string or form data.

jsonToArray (boolean)

When json is true, controls whether a single mobile number is sent as:

wrapper (string)

Wraps the JSON request in a named object. Required by some providers.

wrapperParams (array)

Adds parameters inside the wrapper (separate from regular params).

add_code (boolean)

Automatically prepend country code to phone numbers.


๐Ÿ“ฑ Usage

Using Helper Function

The smsapi() helper provides the most convenient way to send SMS.

Basic Usage

With Extra Parameters

With Custom Headers

Using Different Gateway

Using Different Country Code

Bulk SMS

With Wrapper Parameters

Method Chaining


Using Facade

The facade provides the same functionality with explicit imports.


Using Notifications

Laravel SMS API integrates seamlessly with Laravel's notification system.

Step 1: Add Route to Your Model

In your User model (or any Notifiable model):

Step 2: Create Notification

Step 3: Send Notification

Advanced Notification Examples

With Parameters:

With Headers:

Unicode Message:

Using Static Constructor:

Return String (Shorthand):


๐Ÿ”ฅ Advanced Features

1. Safe Sending Helper

Use send_sms() for operations where you want to catch exceptions:

2. Response Handling

3. Message Validation

Enable validation in config:

Then validate:

4. Dynamic Gateway Selection

5. Environment-based Configuration

6. Multiple Recipients Handling

7. Logging

All requests and responses are automatically logged using Laravel's logging system:


๐ŸŒ Real Provider Examples

Twilio

Usage:


MSG91

Usage:


AWS SNS (via REST API)


Nexmo/Vonage


Generic Bearer Token API


๐Ÿงช Testing

Running Tests

Writing Tests


๐Ÿ“š Changelog

See CHANGELOG.md for version history and breaking changes.

Latest Version: 4.0.0


๐Ÿ› Troubleshooting

SMS Not Sending

  1. Check logs: storage/logs/laravel.log
  2. Verify config: Ensure gateway credentials are correct
  3. Test manually:

Invalid Response

Configuration Not Loading


๐Ÿ’ก Best Practices

  1. Store credentials in .env, never hardcode
  2. Use queued notifications for bulk SMS:

  3. Implement retry logic for critical messages
  4. Monitor costs using estimateSegments()
  5. Test with mock gateway before production
  6. Log all SMS for audit trail

๐Ÿค Support


๐Ÿ™ Credits

Developed by Shivam Agarwal


๐Ÿ“„ License

MIT License - see LICENSE file for details.


โญ Show Your Support

If this package helps you, please give it a star on GitHub!


Made with โค๏ธ for the Laravel community


All versions of laravel-sms-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
ext-mbstring Version *
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.8
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 gr8shivam/laravel-sms-api contains the following files

Loading the files please wait ...