PHPackages                             ghanem/laravel-smsmisr - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. ghanem/laravel-smsmisr

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

ghanem/laravel-smsmisr
======================

Send SMS and SMS Notification via SMS Misr for Laravel

V4.0(3mo ago)205.0k7[1 issues](https://github.com/AbdullahGhanem/laravel-smsmisr/issues)[1 PRs](https://github.com/AbdullahGhanem/laravel-smsmisr/pulls)MITPHPPHP ^8.1CI failing

Since Apr 16Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/AbdullahGhanem/laravel-smsmisr)[ Packagist](https://packagist.org/packages/ghanem/laravel-smsmisr)[ RSS](/packages/ghanem-laravel-smsmisr/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (8)Versions (20)Used By (0)

Laravel SMS Misr (EGYPT)
========================

[](#laravel-sms-misr-egypt)

[![Latest Stable Version](https://camo.githubusercontent.com/e0eff9ae14ecdc0c5d826e31a1c4d97ef94aea6c96ec64997fe02c421b94a5e5/68747470733a2f2f706f7365722e707567782e6f72672f6768616e656d2f6c61726176656c2d736d736d6973722f762f737461626c65)](https://packagist.org/packages/ghanem/laravel-smsmisr) [![Total Downloads](https://camo.githubusercontent.com/dcb66b440e35ff849ce128eec198bec469a89ffef45c9c87552331969258bd65/68747470733a2f2f706f7365722e707567782e6f72672f6768616e656d2f6c61726176656c2d736d736d6973722f646f776e6c6f616473)](https://packagist.org/packages/ghanem/laravel-smsmisr) [![License](https://camo.githubusercontent.com/5b0b3be972fe53ab146e87b4c5a3239732cbf41036453effc76133c5fe58d5f0/68747470733a2f2f706f7365722e707567782e6f72672f6768616e656d2f6c61726176656c2d736d736d6973722f6c6963656e7365)](https://packagist.org/packages/ghanem/laravel-smsmisr)

Laravel package to send SMS and SMS notifications via [SMS Misr](https://www.smsmisr.com/) from your Laravel application.

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

[](#requirements)

- PHP &gt;= 8.1
- Laravel 10, 11, or 12
- SMS Misr account (username/password or API token)

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

[](#installation)

```
composer require ghanem/laravel-smsmisr
```

The package uses Laravel's auto-discovery, so the service provider and facade are registered automatically.

Publish the configuration file:

```
php artisan vendor:publish --provider="Ghanem\LaravelSmsmisr\SmsmisrServiceProvider" --tag="smsmisr-config"
```

Add your credentials to `.env`:

```
SMSMISR_USERNAME=my_username
SMSMISR_PASSWORD=my_password
SMSMISR_SENDER=my_sender
SMSMISR_ENVIRONMENT=1
```

Or use token-based authentication:

```
SMSMISR_TOKEN=my_api_token
SMSMISR_SENDER=my_sender
SMSMISR_ENVIRONMENT=1
```

Usage
-----

[](#usage)

### Sending SMS

[](#sending-sms)

```
use Ghanem\LaravelSmsmisr\Facades\Smsmisr;

$response = Smsmisr::send('Hello world', '01012345678');

if ($response->isSuccessful()) {
    echo $response->message;
}
```

Using the service container:

```
$response = app('smsmisr')->send('Hello world', '01012345678');
```

### Bulk SMS

[](#bulk-sms)

Send to multiple recipients (up to 500K numbers per request):

```
$response = Smsmisr::sendBulk('Hello everyone', [
    '01012345678',
    '01112345678',
    '01212345678',
]);
```

### OTP / Verification SMS

[](#otp--verification-sms)

```
$response = Smsmisr::sendVerify('1234', '01012345678', null, 'your-template');
```

### Scheduled SMS

[](#scheduled-sms)

```
$response = Smsmisr::send(
    message: 'Happy Birthday!',
    to: '01012345678',
    scheduledAt: new DateTime('2026-04-01 09:00:00'),
);

// Also works with bulk
$response = Smsmisr::sendBulk(
    message: 'Sale starts now!',
    recipients: ['01012345678', '01112345678'],
    scheduledAt: new DateTime('2026-04-01 09:00:00'),
);
```

### Queue (Async Sending)

[](#queue-async-sending)

Send SMS in the background via Laravel queues:

```
use Ghanem\LaravelSmsmisr\Facades\Smsmisr;

// Queue a single SMS
Smsmisr::queue('Hello', '01012345678');

// Queue bulk SMS
Smsmisr::queueBulk('Hello everyone', ['01012345678', '01112345678']);

// Queue verification SMS
Smsmisr::queueVerify('1234', '01012345678', null, 'your-template');
```

Configure the queue name in `.env`:

```
SMSMISR_QUEUE=sms
```

Or dispatch the jobs directly:

```
use Ghanem\LaravelSmsmisr\Jobs\SendSmsJob;
use Ghanem\LaravelSmsmisr\Jobs\SendBulkSmsJob;
use Ghanem\LaravelSmsmisr\Jobs\SendVerifySmsJob;

SendSmsJob::dispatch('Hello', '01012345678');
SendBulkSmsJob::dispatch('Hello', ['01012345678', '01112345678']);
SendVerifySmsJob::dispatch('1234', '01012345678', null, 'template');
```

### Checking Balance

[](#checking-balance)

```
$response = Smsmisr::balance();
echo $response->raw['balance'];

$response = Smsmisr::balanceVerify();
```

### Health Check

[](#health-check)

```
if (Smsmisr::health()) {
    // API is reachable and credentials are valid
}
```

### Response Object

[](#response-object)

All API methods return a `SmsmisrResponse` object:

```
$response->isSuccessful(); // bool
$response->isFailed();     // bool
$response->code;           // int (e.g. 1901)
$response->message;        // string
$response->raw;            // array (full API response)
$response->toArray();      // array
```

### Error Handling

[](#error-handling)

```
use Ghanem\LaravelSmsmisr\Exceptions\SmsmisrApiException;
use Ghanem\LaravelSmsmisr\Exceptions\SmsmisrAuthenticationException;
use Ghanem\LaravelSmsmisr\Exceptions\SmsmisrInsufficientBalanceException;
use Ghanem\LaravelSmsmisr\Exceptions\SmsmisrRateLimitException;

try {
    $response = Smsmisr::send('Hello', '01012345678');
} catch (SmsmisrAuthenticationException $e) {
    // Invalid credentials
} catch (SmsmisrInsufficientBalanceException $e) {
    // Not enough SMS credits
} catch (SmsmisrRateLimitException $e) {
    // Rate limit exceeded
} catch (SmsmisrApiException $e) {
    $e->getCode();       // Error code
    $e->getMessage();    // Error message
    $e->getResponse();   // Full response array
}
```

Phone Number Normalization
--------------------------

[](#phone-number-normalization)

The package automatically normalizes Egyptian phone numbers to international format:

- `01012345678` -&gt; `201012345678`
- `+201012345678` -&gt; `201012345678`
- `00201012345678` -&gt; `201012345678`
- `010-1234-5678` -&gt; `201012345678`

Disable in config:

```
SMSMISR_AUTO_NORMALIZE=false
```

### Validation Rule

[](#validation-rule)

```
use Ghanem\LaravelSmsmisr\Rules\EgyptianPhoneNumber;

$request->validate([
    'phone' => ['required', new EgyptianPhoneNumber],
]);
```

Validates prefixes: `010`, `011`, `012`, `015`.

Events
------

[](#events)

EventWhenProperties`SmsSending`Before sending`to`, `message`, `sender`, `type``SmsSent`After success`to`, `message`, `sender`, `response`, `type``SmsFailed`On failure`to`, `message`, `sender`, `exception`, `type``LowBalance`Balance check alert`smsBalance`, `verifyBalance`, `threshold`The `type` is `'sms'`, `'otp'`, or `'bulk'`.

```
use Ghanem\LaravelSmsmisr\Events\SmsSent;
use Ghanem\LaravelSmsmisr\Events\LowBalance;

Event::listen(SmsSent::class, function (SmsSent $event) {
    logger("SMS sent to {$event->to}");
});

Event::listen(LowBalance::class, function (LowBalance $event) {
    // Send alert to admin
});
```

Artisan Commands
----------------

[](#artisan-commands)

```
# Display current SMS and Verify balance
php artisan smsmisr:balance

# Check balance against threshold and dispatch LowBalance event if below
php artisan smsmisr:check-balance
php artisan smsmisr:check-balance --threshold=500
```

Schedule the balance check in your `routes/console.php`:

```
Schedule::command('smsmisr:check-balance')->daily();
```

Notifications
-------------

[](#notifications)

```
namespace App\Notifications;

use Ghanem\LaravelSmsmisr\SmsmisrChannel;
use Ghanem\LaravelSmsmisr\SmsmisrMessage;
use Illuminate\Notifications\Notification;

class OrderShipped extends Notification
{
    public function via($notifiable): array
    {
        return [SmsmisrChannel::class];
    }

    public function toSmsmisr($notifiable): SmsmisrMessage
    {
        return (new SmsmisrMessage('Your order has been shipped!', $notifiable->phone))
            ->sender('MyApp');
    }
}
```

### OTP Notification

[](#otp-notification)

```
public function toSmsmisr($notifiable): SmsmisrMessage
{
    return (new SmsmisrMessage())
        ->to($notifiable->phone)
        ->asVerification('1234', 'your-template-id');
}
```

### Scheduled Notification

[](#scheduled-notification)

```
public function toSmsmisr($notifiable): SmsmisrMessage
{
    return (new SmsmisrMessage('Reminder: appointment tomorrow', $notifiable->phone))
        ->scheduledAt(new DateTime('2026-04-01 09:00:00'));
}
```

### SmsmisrMessage API

[](#smsmisrmessage-api)

```
(new SmsmisrMessage(string $message, string $to))
    ->message(string $message)
    ->to(string $to)
    ->sender(string $sender)
    ->unicode(bool $unicode)
    ->asVerification(string $code, ?string $template)
    ->scheduledAt(DateTimeInterface $dateTime)
```

Testing
-------

[](#testing)

### In Your Application

[](#in-your-application)

```
use Ghanem\LaravelSmsmisr\Facades\Smsmisr;

public function test_order_sends_sms(): void
{
    Smsmisr::fake();

    // ... trigger SMS ...

    Smsmisr::assertSent('01012345678', 'Your order has been shipped!');
    Smsmisr::assertSentCount(1);
}
```

Available assertions:

```
Smsmisr::fake();

// Sent
Smsmisr::assertSent($to, $message);
Smsmisr::assertSentCount($count);
Smsmisr::assertNothingSent();
Smsmisr::assertSentWithSchedule($to);

// Verification
Smsmisr::assertVerifySent($to, $code);
Smsmisr::assertVerifySentCount($count);

// Bulk
Smsmisr::assertBulkSent($message);
Smsmisr::assertBulkSentCount($count);
Smsmisr::assertBulkSentTo($recipients);

// Queue
Smsmisr::assertQueued($to, $message);
Smsmisr::assertQueuedCount($count);
Smsmisr::assertVerifyQueued($to, $code);
Smsmisr::assertNothingQueued();

// Inspect
Smsmisr::getSent();
Smsmisr::getBulk();
Smsmisr::getVerified();
Smsmisr::getQueued();
```

### Running Package Tests

[](#running-package-tests)

```
composer test
```

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

[](#configuration)

KeyEnv VariableDefaultDescription`environment``SMSMISR_ENVIRONMENT``1`1 = Live, 2 = Test`endpoint``SMSMISR_ENDPOINT``https://smsmisr.com/api/`API endpoint`username``SMSMISR_USERNAME``null`Account username`password``SMSMISR_PASSWORD``null`Account password`token``SMSMISR_TOKEN``null`API token (alternative auth)`sender``SMSMISR_SENDER``null`Default sender name`auto_normalize``SMSMISR_AUTO_NORMALIZE``true`Auto-normalize phone numbers`timeout``SMSMISR_TIMEOUT``30`HTTP timeout (seconds)`retries``SMSMISR_RETRIES``0`Retry attempts on failure`retry_delay``SMSMISR_RETRY_DELAY``100`Delay between retries (ms)`rate_limit``SMSMISR_RATE_LIMIT``null`Max messages per minute`queue``SMSMISR_QUEUE``null`Queue name for async sending`log_channel``SMSMISR_LOG_CHANNEL``null`Log channel for SMS operations`low_balance_threshold``SMSMISR_LOW_BALANCE_THRESHOLD``100`Alert threshold for balance checkLicense
-------

[](#license)

MIT

Sponsor
-------

[](#sponsor)

[Become a Sponsor](https://github.com/sponsors/AbdullahGhanem)

###  Health Score

54

—

FairBetter than 96% of packages

Maintenance77

Regular maintenance activity

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 70.2% 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 ~148 days

Recently: every ~543 days

Total

18

Last Release

118d ago

Major Versions

v1.11 → v2.012020-03-27

v2.06 → v3.0.12022-03-04

v3.0.1 → V4.02026-03-08

PHP version history (3 changes)v1.0PHP &gt;=7.0

v3.0.1PHP ^8.0

V4.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/fafeedb68c6ad2ddbb249caed67289c8c74073d25fcfb210534a9769d393dda4?d=identicon)[ghanem](/maintainers/ghanem)

---

Top Contributors

[![AbdullahGhanem](https://avatars.githubusercontent.com/u/5055892?v=4)](https://github.com/AbdullahGhanem "AbdullahGhanem (33 commits)")[![Saifallak](https://avatars.githubusercontent.com/u/6053156?v=4)](https://github.com/Saifallak "Saifallak (7 commits)")[![a-j-n](https://avatars.githubusercontent.com/u/34508885?v=4)](https://github.com/a-j-n "a-j-n (4 commits)")[![maherelgamil](https://avatars.githubusercontent.com/u/6294478?v=4)](https://github.com/maherelgamil "maherelgamil (2 commits)")[![mohamed-foly](https://avatars.githubusercontent.com/u/11143873?v=4)](https://github.com/mohamed-foly "mohamed-foly (1 commits)")

---

Tags

egyptlaravelsmssms-gatewaysmsmisrapilaravelnotificationsmschannelEgyptsmsmisr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ghanem-laravel-smsmisr/health.svg)

```
[![Health](https://phpackages.com/badges/ghanem-laravel-smsmisr/health.svg)](https://phpackages.com/packages/ghanem-laravel-smsmisr)
```

###  Alternatives

[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k30.0M148](/packages/laravel-cashier)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2401.4M17](/packages/laravel-notification-channels-discord)[api-platform/laravel

API Platform support for Laravel

58171.8k14](/packages/api-platform-laravel)

PHPackages © 2026

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