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

On this page you can find all versions of the php package diereysaa/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 GitHub license

Integrate SMS API with Laravel

Laravel package to provide SMS API integration. Any SMS vendor that provides REST API can be used.

Star ⭐ repo to show suport 😊

Installation

Install Package

Require this package with composer:

Add Service Provider & Facade

For Laravel 5.5+

Once the package is added, the service provider and facade will be autodiscovered.

For Older versions of Laravel

Add the ServiceProvider to the providers array in config/app.php:

Add the Facade to the aliases array in config/app.php:

Publish Config

Once done, publish the config to your config folder using:

Configuration

Once the config file is published, open config/sms-api.php

Global config

country_code : The default country code to be used

default : Default gateway

Gateway Config

Use can define multiple gateway configs like this:-

Special Parameters in Gateway Config

json Parameter

The json parameter accepts true/false. When true, it sends params as a JSON payload. It also takes care of 'Content-Type' => 'application/json' header.

jsonToArray Parameter

The jsonToArray parameter accepts true/false. When true, it sends a single mobile number in an encapsulated array in the JSON payload. When false, a single mobile number is sent as text. Valid only when json parameter is true.

wrapper Parameter

The wrapper is a special parameter which will be required only with some gateways. It wraps the JSON payload in the following structure:

wrapperParams Parameter

Accepts array. Used to add custom Wrapper Parameters. Parameters can also be added while calling the smsapi() function like smsapi()->addWrapperParams(['wrapperParam1'=>'paramVal'])->sendMessage("TO", "Message")

Usage

Direct Use

Use the smsapi() helper function or SmsApi facade to send the messages.

TO: Single mobile number or Multiple comma-separated mobile numbers

MESSAGE: Message to be sent

Using Helper function

Using SmsApi facade

Use in Notifications

Setting up the Route for Notofication

Add the method routeNotificationForSmsApi() to your Notifiable model :

By default, your User model uses Notifiable.

Setting up Notification

Add

use Gr8Shivam\SmsApi\Notifications\SmsApiChannel;

and

use Gr8Shivam\SmsApi\Notifications\SmsApiMessage;

to your notification.

You can create a new notification with php artisan make:notification NOTIFICATION_NAME

In the via function inside your notification, add return [SmsApiChannel::class]; and add a new function toSmsApi($notifiable) to return the message body and parameters.

Notification example:-

You can also use ->params(["param1" => "val"]) to add extra parameters to the request and ->headers(["header1" => "val"]) to add extra headers to the request.

Getting Response

You can get response by using ->response() or get the Response Code using ->getResponseCode(). For example, smsapi()->sendMessage("TO","MESSAGE")->response();

Support

Feel free to post your issues in the issues section.

Credits

Developed by Shivam Agarwal

Thanks to laravel-ovh-sms & softon-sms

License

MIT


All versions of laravel-sms-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
illuminate/support Version ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ~6.0|^7.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 diereysaa/laravel-sms-api contains the following files

Loading the files please wait ....