Download the PHP package aghfatehi/laravel-msegat without Composer

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

PHP Version Laravel Version Msegat License CI Packagist Downloads

Laravel Msegat

SMS, OTP, and WhatsApp integration for the Msegat gateway

Production-ready for SaaS, enterprise, and open-source projects. Supports Laravel 10, 11, and 12 with PHP 8.2+.
Created by AL-AGHBARI Fatehi


Installation

Laravel auto-discovery registers the service provider and facade automatically.

Publish Configuration

Publish Migrations (Optional)

Track sent messages, OTP requests, delivery reports, and webhooks in your database. If you publish and run the migrations, five tables will be created:

Table Purpose
msegat_sms_logs History of all sent SMS messages
msegat_otp_requests OTP request tracking
msegat_delivery_reports Delivery report storage from Msegat
msegat_webhook_logs Webhook event log
msegat_failed_requests Failed request records

This step is optional. The package works fully without migrations — skip this section if you don't need database logging.

Option A — Run migrations directly from the package (recommended):

Runs only the package's migrations without publishing:

Option B — Publish then migrate (if you need to modify the migrations):

Configuration

Add to your .env (required variables marked with REQUIRED):

Config Options

Variable Default Required Description
MSEGAT_USERNAME Yes Msegat account username
MSEGAT_API_KEY Yes Msegat API key
MSEGAT_SENDER '' No Default sender name
MSEGAT_BASE_URL https://www.msegat.com/gw/ No API base URL
MSEGAT_TIMEOUT 30 No HTTP request timeout (seconds)
MSEGAT_RETRIES 3 No Max retry attempts on failure
MSEGAT_VERIFY_SSL true No Verify SSL certificate
MSEGAT_QUEUE_ENABLED false No Enable async webhook processing
MSEGAT_LOGGING_ENABLED true No Enable request/response logging
MSEGAT_WEBHOOK_SECRET '' No Secret for webhook signature verification
MSEGAT_WHATSAPP_EMAIL No T2 Communicate WhatsApp login email
MSEGAT_WHATSAPP_PASSWORD No T2 Communicate WhatsApp login password
MSEGAT_WHATSAPP_BASE_URL https://communicateapi.t2.sa/api No T2 WhatsApp API base URL
MSEGAT_WHATSAPP_TOKEN_CACHE_TTL 3300 No JWT token cache TTL (seconds)

Usage

SMS

Personalized Messages

OTP

WhatsApp (T2 Communicate API)

WhatsApp messages are sent via the T2 Communicate WhatsApp Business API — a separate gateway from Msegat SMS. Requires its own credentials.

Text Message

Template Message

Response Object

Field Type Description
successful bool Whether the API accepted the message
messageId string Unique message ID for tracking
conversationId string WhatsApp conversation ID
contactNumber string Recipient phone number
status string Sent, Delivered, Read, Failed, etc.
contactName string|null Contact display name

Balance

Message Cost Calculation

Sender Management

Retrieve Messages

Test Message


Queue Support

The SendSmsJob retries up to 3 times with a 5-second backoff.


Events

Event Payload Description
MessageSending $data (array) Before sending SMS
MessageSent $response (SmsResponse) After SMS or WhatsApp sent
OtpGenerated $number, $response (OtpResponse) After OTP sent
OtpVerified $number, $code, $response (OtpResponse) After OTP verified
WebhookReceived $type, $payload (array) When webhook is received

Example listener registration in EventServiceProvider:


Webhooks

The package registers four webhook routes under the /webhook/msegat/ prefix:

Route Purpose
POST /webhook/msegat/delivery Delivery reports
POST /webhook/msegat/status Message status updates
POST /webhook/msegat/incoming Incoming messages
POST /webhook/msegat/failed Failed messages

Signature Verification

Set MSEGAT_WEBHOOK_SECRET in .env and each webhook request must include:

Requests outside a 5-minute tolerance window are rejected.


Notification Channel

Add routeNotificationForMsegat() to your notifiable model:


Artisan Commands


Testing

With coverage:

The test suite includes:


Code Quality (For Contributors)


Database Migrations

Table Purpose
msegat_sms_logs SMS send history
msegat_otp_requests OTP request tracking
msegat_delivery_reports Delivery report storage
msegat_webhook_logs Webhook event log
msegat_failed_requests Failed request records

Status Codes and Messages

Success

Code Message
M0000 Success

Errors

Code Message
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

Changelog

See CHANGELOG for recent changes.


Security

If you discover any security-related issues, please email instead of using the issue tracker.


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

If you have any questions or issues, feel free to open an issue on the GitHub repository or contact the author AL-AGHBARI Fatehi.


License

The MIT License (MIT). See LICENSE for details.


All versions of laravel-msegat with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/notifications Version ^10.0|^11.0|^12.0
illuminate/queue Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/events Version ^10.0|^11.0|^12.0
ext-json Version *
ext-mbstring Version *
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 aghfatehi/laravel-msegat contains the following files

Loading the files please wait ...