PHPackages                             al-saloul/msegat - 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. al-saloul/msegat

ActiveLibrary

al-saloul/msegat
================

This is a Laravel package for Msegat. Its goal is to remove the complexity

v1.0.3(1y ago)212.2k3MITPHP

Since Sep 30Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/al-saloul/msegat-laravel)[ Packagist](https://packagist.org/packages/al-saloul/msegat)[ RSS](/packages/al-saloul-msegat/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (6)Used By (0)

Msegat Laravel Package
======================

[](#msegat-laravel-package)

This is a Laravel package that integrates with the Msegat SMS service. It simplifies the process of sending SMS messages through the Msegat API by providing an easy-to-use wrapper for Laravel applications.

Features
--------

[](#features)

- Send SMS messages easily using the Msegat API.
- Configurable credentials (username, API key, sender name) through the `.env` file.
- Designed specifically for Laravel applications.

Requirements
------------

[](#requirements)

- **Laravel:** 6 or higher
- **PHP:** 7 or higher

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

[](#installation)

To install the package, use Composer:

```
composer require al-saloul/msegat
```

Publish Configuration
---------------------

[](#publish-configuration)

To publish the configuration file, use the following command:

```
php artisan vendor:publish --provider="Alsaloul\Msegat\MsegatServiceProvider"
```

This will create a configuration file named `msegat.php` in your `config` folder.

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env` file:

```
MSEGAT_BASEURL="https://www.msegat.com"
MSEGAT_USERNAME=your_msegat_username
MSEGAT_API_KEY=your_msegat_api_key
MSEGAT_USER_SENDER=your_msegat_sender_name
```

Alternatively, you can directly edit the `config/msegat.php` file to set the required configuration.

Usage
-----

[](#usage)

To send an SMS message, use the `Msegat` facade:

```
use Alsaloul\Msegat\Msegat;

$response = Msegat::sendMessage('966123456789', 'Hello, this is a test message!');

if ($response['code'] === '1') {
    echo "Message sent successfully!";
} else {
    echo "Failed to send message.";
}
```

Methods
-------

[](#methods)

`Msegat::sendMessage($numbers, $message)`

- $numbers: The phone numbers to send the message to, separated by commas. (e.g., `96651xxxxxxx`,`96652xxxxxxx`)
- $message: The content of the message.

This method will send the message to the given numbers using the Msegat API.

`Msegat::data($numbers, $message)`

This method generates the JSON payload required for sending SMS messages. It's used internally by the `sendMessage()` method.

Examples
--------

[](#examples)

### Sending a Single Message

[](#sending-a-single-message)

```
Msegat::sendMessage('9665xxxxxxxx', 'Hello from Msegat!');
```

### Sending Multiple Messages

[](#sending-multiple-messages)

```
$numbers = '96651xxxxxxx,96652xxxxxxx';
$message = 'This is a broadcast message.';

$response = Msegat::sendMessage($numbers, $message);
```

### Handling Errors

[](#handling-errors)

If credentials or required parameters are not set, exceptions will be thrown:

```
try {
    Msegat::sendMessage('966123456789', 'Testing error handling.');
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

Status Code and Messages
------------------------

[](#status-code-and-messages)

- `1` - Success
- `M0000` - Success
- `M0001` - Variables missing
- `M0002` - Invalid login info
- `M0022` - Exceed number of senders allowed
- `M0023` - Sender Name is active or under activation or refused
- `M0024` - Sender Name should be in English or number
- `M0025` - Invalid Sender Name Length
- `M0026` - Sender Name is already activated or not found
- `M0027` - Activation Code is not Correct
- `1010` - Variables missing
- `1020` - Invalid login info
- `1050` - MSG body is empty
- `1060` - Balance is not enough
- `1061` - MSG duplicated
- `1064` - Free OTP , Invalid MSG content you should use "Pin Code is: xxxx", "Verification Code: xxxx" or upgrade your account and activate your sender to send any content
- `1110` - Sender name is missing or incorrect
- `1120` - Mobile numbers is not correct
- `1140` - MSG length is too long
- `M0029` - Invalid Sender Name - Sender Name should contain only letters, numbers and the maximum length should be 11 characters
- `M0030` - Sender Name should ended with AD
- `M0031` - Maximum allowed size of uploaded file is 5 MB
- `M0032` - Only pdf,png,jpg and jpeg files are allowed!
- `M0033` - Sender Type should be normal or whitelist only
- `M0034` - Please Use POST Method
- `M0036` - There is no any sender

Contributing
------------

[](#contributing)

Contributions are welcome! Please follow these steps to contribute:

1. Fork the repository.
2. Create a new branch (`git checkout -b feature/new-feature`).
3. Commit your changes (`git commit -am 'Add new feature'`).
4. Push to the branch (`git push origin feature/new-feature`).
5. Create a new Pull Request.

Support
-------

[](#support)

If you have any questions or issues, feel free to open an issue on the GitHub repository or contact the author via email at `eng.alsaloul.mohammed@gmail.com`.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance55

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Total

5

Last Release

519d ago

Major Versions

v1.0.2 → v2.x-dev2024-09-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a2776dd1dd2c91f8bac075de5cd7c2e9fb7f987083d643c4e3373724b27f542?d=identicon)[al-saloul](/maintainers/al-saloul)

---

Top Contributors

[![al-saloul](https://avatars.githubusercontent.com/u/96193006?v=4)](https://github.com/al-saloul "al-saloul (9 commits)")

### Embed Badge

![Health badge](/badges/al-saloul-msegat/health.svg)

```
[![Health](https://phpackages.com/badges/al-saloul-msegat/health.svg)](https://phpackages.com/packages/al-saloul-msegat)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
