PHPackages                             vluebridge/sms-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vluebridge/sms-engine

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vluebridge/sms-engine
=====================

The SMS engine provides a way to send any SMS message to any mobile number and provide abstraction to SMS suppliers so it just works.

v1.0(5y ago)181MITPHPPHP ^5.5

Since Jan 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Vluebridge/SMS-Engine)[ Packagist](https://packagist.org/packages/vluebridge/sms-engine)[ RSS](/packages/vluebridge-sms-engine/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

SMS Engine
==========

[](#sms-engine)

SMS Engine is a PHP Library that wraps the implementation of SMS gateways ([Semaphore](https://semaphore.co/), [MyBusyBee](https://www.mybusybee.net/)) so you can send SMS using two simple lines of code:

```
$engine = SmsEngine::init('semaphore', 'xxxxxxx');

$engine->send("09xxxxxxxxx", "Your message", "Sender Name");
// Your `Sender Name` must be purchased & approved, or it'll throw InvalidSenderNameException
```

Table of Contents
=================

[](#table-of-contents)

- [Supported SMS Suppliers](#supported-sms-suppliers)
- [Installation](#installation)
- [How To Use](#how-to-use)
    - [For Any PHP Project](#for-any-php-project)
    - [For Laravel](#for-laravel)
- [Exception Handling](#exception-handling)
- [Registering your own SMS gateway](#registering-your-own-sms-gateway)

Supported SMS Suppliers
-----------------------

[](#supported-sms-suppliers)

Right now, these are the only two SMS suppliers (or SMS Gateways) that are supported in this package:

- [Semaphore](https://semaphore.co/)
- [MyBusyBee](https://www.mybusybee.net/)

If you wish you support an SMS gateway of your choice, feel free to submit a pull request.

Installation
------------

[](#installation)

```
composer require vluebridge/sms-engine
```

How To Use
----------

[](#how-to-use)

It's important to note that you need to have a registered account from the [supported SMS Suppliers](#supported-sms-suppliers) above. You'll get your own API key when you login on their application.

> For performance reasons, I highly recommend that you send SMS through a [job](https://laravel.com/docs/8.x/queues#creating-jobs), especially if you're gonna send 20+ SMS in one HTTP request.
>
> Your server will communicate with the SMS Supplier's API server and you could potentially hit your [max\_execution\_time](https://www.php.net/manual/en/info.configuration.php#ini.max-execution-time) especially if you put this code in a loop.

#### For Any PHP Project

[](#for-any-php-project)

Just write the following lines of code to wherever you want to start sending SMS.

```
