PHPackages                             zing/laravel-sms - 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. zing/laravel-sms

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

zing/laravel-sms
================

Provides sms notification channel for Laravel.

6.7.0(1mo ago)74.9k2[1 issues](https://github.com/zingimmick/laravel-sms/issues)MITPHPPHP ^8.0CI passing

Since Apr 10Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/zingimmick/laravel-sms)[ Packagist](https://packagist.org/packages/zing/laravel-sms)[ Docs](https://github.com/zingimmick/laravel-sms)[ RSS](/packages/zing-laravel-sms/feed)WikiDiscussions 6.x Synced 1mo ago

READMEChangelog (10)Dependencies (22)Versions (91)Used By (0)

Laravel Sms
===========

[](#laravel-sms)

[![Tests](https://github.com/zingimmick/laravel-sms/actions/workflows/tests.yml/badge.svg?branch=6.x)](https://github.com/zingimmick/laravel-sms/actions/workflows/tests.yml)[![Code Coverage](https://camo.githubusercontent.com/243d41cdbd3b911b591ec2aa0a1e9d47269fcd411bc90724e4b91fb93dccf32d/68747470733a2f2f636f6465636f762e696f2f67682f7a696e67696d6d69636b2f6c61726176656c2d736d732f6272616e63682f362e782f67726170682f62616467652e737667)](https://codecov.io/gh/zingimmick/laravel-sms)[![Latest Stable Version](https://camo.githubusercontent.com/af7759c7397bf89cf1113a5701517bcc3ecd67b0243675b6d49b7046d038ae16/68747470733a2f2f706f7365722e707567782e6f72672f7a696e672f6c61726176656c2d736d732f762f737461626c652e737667)](https://packagist.org/packages/zing/laravel-sms)[![Total Downloads](https://camo.githubusercontent.com/847b5007683d9c6dd689359d6fbdabd21d9cbf32fe10bc526c271aa072b0d09f/68747470733a2f2f706f7365722e707567782e6f72672f7a696e672f6c61726176656c2d736d732f646f776e6c6f616473)](https://packagist.org/packages/zing/laravel-sms)[![Latest Unstable Version](https://camo.githubusercontent.com/e02a35ff4d447800b4240f94f4c91ba355c7c6b9f73a653218565278c190138d/68747470733a2f2f706f7365722e707567782e6f72672f7a696e672f6c61726176656c2d736d732f762f756e737461626c652e737667)](https://packagist.org/packages/zing/laravel-sms)[![License](https://camo.githubusercontent.com/15f1a175aed6f3f26f9b970dca6a490f06f84270f8363aa1c318dbb043654f84/68747470733a2f2f706f7365722e707567782e6f72672f7a696e672f6c61726176656c2d736d732f6c6963656e7365)](https://packagist.org/packages/zing/laravel-sms)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/36b98fc0bf77c1f611a83ae5fa05df8caf7e908d0c6259654404b26e7016c412/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7a696e67696d6d69636b2f6c61726176656c2d736d732f6261646765732f7175616c6974792d73636f72652e706e673f623d362e78)](https://scrutinizer-ci.com/g/zingimmick/laravel-sms)[![StyleCI Shield](https://camo.githubusercontent.com/59f5a2d6cf74156b5dc30163e23833f990afdc94bbda284fe61a6c56f2f18739/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3235343535393833312f736869656c643f6272616e63683d362e78)](https://github.styleci.io/repos/254559831)[![Code Climate](https://camo.githubusercontent.com/6d3151db678546c4ba44af739fafc5d6b052690bced6a35fcfa4cc195d16f6ee/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39633831623063396364656263323362613236662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/zingimmick/laravel-sms/maintainability)[![FOSSA Status](https://camo.githubusercontent.com/64d8c3df6a1fff1bb256ff5cdc2e1a59f1bdd2a47f8bc334fcae1234035eb905/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467a696e67696d6d69636b2532466c61726176656c2d736d732e7376673f747970653d736869656c64)](https://app.fossa.com/projects/git%2Bgithub.com%2Fzingimmick%2Flaravel-sms?ref=badge_shield)

Laravel Sms is used to notify via sms and send a message.

Thanks
------

[](#thanks)

Many thanks to:

- [JetBrains](https://www.jetbrains.com/?from=LaravelSms) for the excellent **PhpStorm IDE** and providing me with an open source license to speed up the project development.

    [![JetBrains](/docs/jetbrains.svg)](https://www.jetbrains.com/?from=LaravelSms)

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

[](#requirements)

- [PHP 8.0+](https://php.net/releases/)
- [Composer](https://getcomposer.org)
- [Laravel 8.0+](https://laravel.com/docs/releases)

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

[](#installation)

### Composer

[](#composer)

Execute the following command to get the latest version of the package:

```
composer require zing/laravel-sms

```

### Laravel

[](#laravel)

Publish Configuration

```
php artisan vendor:publish --provider "Zing\LaravelSms\SmsServiceProvider"
```

### Add Connections

[](#add-connections)

This package based on [overtrue/easy-sms](https://github.com/overtrue/easy-sms), driver is the gateway.

Usage
-----

[](#usage)

### Channel

[](#channel)

#### Create a Notification

[](#create-a-notification)

```
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class Verification extends Notification implements ShouldQueue
{
    use Queueable;

    protected $code;

    /**
     * Verification constructor.
     *
     * @param $code
     */
    public function __construct($code)
    {
        $this->code = $code;
    }

    public function via()
    {
        return ['sms'];
    }

    public function toSms($notifiable)
    {
        return "验证码 {$this->code}，您正在进行身份验证，打死也不要告诉别人哦!";
    }
}
```

#### Add notification route for sms to your notifiable

[](#add-notification-route-for-sms-to-your-notifiable)

```
use Illuminate\Notifications\Notifiable;

class User
{
    use Notifiable;

    public function routeNotificationForSms($notification)
    {
        return $this->phone;
    }
}
```

#### Send notification

[](#send-notification)

```
use Illuminate\Support\Facades\Notification;

$user = new User();
// use Notifiable Trait
$user->notify(new Verification('1111'));
// use Notification Facade
Notification::send($user, new Verification('1111'));
```

#### Send to anonymous notifiable

[](#send-to-anonymous-notifiable)

```
use Illuminate\Support\Facades\Notification;
use Zing\LaravelSms\SmsNumber;
use Zing\LaravelSms\Channels\SmsChannel;

// use channel class name
Notification::route(SmsChannel::class, new SmsNumber(18188888888, 86))->notify(new Verification('1111'));
// use channel alias
Notification::route('sms', new SmsNumber(18188888888, 86))->notify(new Verification('1111'));
```

### Facade

[](#facade)

#### Send Message

[](#send-message)

```
use Zing\LaravelSms\Facades\Sms;

// use default connection
Sms::send(18188888888, 'test message.');
// use specific connection
Sms::connection('null')->send(18188888888, 'test message.');
// or
Sms::via('null')->send(18188888888, 'test message.');
```

Specific usage
--------------

[](#specific-usage)

### Use specific connection for notification

[](#use-specific-connection-for-notification)

**NOTE:** Only support for `Zing\LaravelSms\SmsMessage`

```
use Zing\LaravelSms\SmsMessage;

public function toSms($notifiable)
{
    return (new SmsMessage())->onConnection('log');
}
```

### Make PhoneNumber notifiable

[](#make-phonenumber-notifiable)

**NOTE:** Only support for `Zing\LaravelSms\SmsNumber`

```
use Zing\LaravelSms\SmsNumber;

(new SmsNumber(18188888888))->notify(new Verification('1111'));
```

License
-------

[](#license)

Laravel Sms is open-sourced software licensed under the [MIT license](LICENSE).

[![FOSSA Status](https://camo.githubusercontent.com/efc1eaca9d55d024767124bccb74bd7a18871c2605cc9c1bbde2f21a4f03415f/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467a696e67696d6d69636b2532466c61726176656c2d736d732e7376673f747970653d6c61726765)](https://app.fossa.com/projects/git%2Bgithub.com%2Fzingimmick%2Flaravel-sms?ref=badge_large)

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance87

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 73.6% 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 ~26 days

Recently: every ~185 days

Total

83

Last Release

52d ago

Major Versions

2.3.0 → 3.0.02020-06-20

2.x-dev → 3.0.12020-07-07

3.6.1 → 4.0.02021-11-01

4.x-dev → 5.0.02022-03-09

5.x-dev → 6.0.02022-12-08

PHP version history (5 changes)0.0.1PHP ^7.2.5

3.0.0-alpha.2PHP ^7.3

3.3.1PHP ^7.2 || ^8.0

5.0.0PHP ^7.3 || ^8.0

6.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fafa5bffa28dcd722432b244bf3f0bfe773406df29fea295847e2397b95d50b?d=identicon)[zingimmick](/maintainers/zingimmick)

---

Top Contributors

[![zingimmick](https://avatars.githubusercontent.com/u/26657141?v=4)](https://github.com/zingimmick "zingimmick (447 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (113 commits)")[![kodiakhq[bot]](https://avatars.githubusercontent.com/in/29196?v=4)](https://github.com/kodiakhq[bot] "kodiakhq[bot] (28 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")[![deepsource-autofix[bot]](https://avatars.githubusercontent.com/in/57168?v=4)](https://github.com/deepsource-autofix[bot] "deepsource-autofix[bot] (3 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (3 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (2 commits)")[![undecane](https://avatars.githubusercontent.com/u/83295392?v=4)](https://github.com/undecane "undecane (2 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")

---

Tags

laravelnotificationsmslaravelnotificationsmschannel

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/zing-laravel-sms/health.svg)

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

###  Alternatives

[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[ghanem/laravel-smsmisr

Send SMS and SMS Notification via SMS Misr for Laravel

194.8k](/packages/ghanem-laravel-smsmisr)

PHPackages © 2026

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