PHPackages                             lizhineng/dysms-notification-channel - 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. lizhineng/dysms-notification-channel

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

lizhineng/dysms-notification-channel
====================================

Dysms Notification Channel for Laravel.

v2.0.0(3y ago)0296MITPHPPHP ^8.0

Since Aug 27Pushed 3y agoCompare

[ Source](https://github.com/lizhineng/dysms-notification-channel)[ Packagist](https://packagist.org/packages/lizhineng/dysms-notification-channel)[ Docs](https://github.com/lizhineng/dysms-notification-channel)[ RSS](/packages/lizhineng-dysms-notification-channel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

Sending SMS through Alibaba Cloud in Laravel.
=============================================

[](#sending-sms-through-alibaba-cloud-in-laravel)

This package makes it easy to send notifications using [Alibaba Cloud Short Message Service](https://cn.aliyun.com/product/sms) with Laravel 9.x, and also requires PHP 8.0+.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up Dysms service](#setting-up-dysms-service)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

You can install the package via Composer:

```
composer require lizhineng/dysms-notification-channel
```

### Setting up Dysms service

[](#setting-up-dysms-service)

The package includes a [configuration file](config/dysms.php). However, you are not required to export this configuration file to your own application. You can simply set the `DYSMS_KEY` and `DYSMS_SECRET` environment variables to define your Dysms API credentials which may be accessed from your [Aliyun RAM dashboard](https://ram.console.aliyun.com).

Based on the principle of least privilege, the only required RAM permission to the credentials is `dysms:SendSms`, then you're good to go. Here is an example policy in case you need it:

```
{
    "Version": "1",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "dysms:SendSms",
            "Resource": "*"
        }
    ]
}
```

After defining your keys, you may set a `DYSMS_SIGNATURE` environment variable that defines the signature that your SMS messages should be attached to by default. You may apply your signature on [Aliyun SMS Console](https://dysms.console.aliyun.com):

```
DYSMS_SIGNATURE=YOUR_COMPANY_NAME
```

Usage
-----

[](#usage)

You can now use the channel in your `via()` method inside the notification. **Note**, before you can successfully send the message out, according to the Aliyun regulation, you need to apply the template to be reviewed first.

```
use Illuminate\Notifications\Notification;
use Zhineng\Notifications\Channels\DysmsChannel;
use Zhineng\Notifications\Messages\DysmsMessage;

class OrderPlaced extends Notification
{
    public function via($notifiable)
    {
        return ['dysms'];
    }

    public function toDysms($notifiable)
    {
        return (new DysmsMessage)
            ->using('SMS_TEMPLATE_CODE')
            ->with(['if' => 'any'])
            ->signedBy('YOUR_PERMITTED_SIGNATURE');
    }
}
```

In order to let the channel know who's the recipient, add the method `routeNotificationForDysms` to your notifiable class.

```
// App\Models\User.php

public function routeNotificationForDysms($notification)
{
    return $this->phone_number;
}
```

### Available message methods

[](#available-message-methods)

- `using(string $templateCode)`: Accepts the SMS template code.
- `with(array $payload)`: The parameters which needs to be injected into the template.
- `signedBy(string $signature)`: The name of the sender, which also needs to be reviewed first.
- `serialNumber(string $serialNumber)`: The order number, uuid, you name it.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Li Zhineng](https://github.com/lizhineng)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97% 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 ~170 days

Total

3

Last Release

1380d ago

Major Versions

v0.0.1 → v1.0.02022-06-17

v1.0.0 → v2.0.02022-08-02

PHP version history (2 changes)v0.0.1PHP &gt;=8.0

v1.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2339485?v=4)[Zhineng Li](/maintainers/lizhineng)[@lizhineng](https://github.com/lizhineng)

---

Top Contributors

[![lizhineng](https://avatars.githubusercontent.com/u/2339485?v=4)](https://github.com/lizhineng "lizhineng (32 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

aliyun-smsdysmslaravelnotificationslaravelnotificationsAliyun-Smsdysms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lizhineng-dysms-notification-channel/health.svg)

```
[![Health](https://phpackages.com/badges/lizhineng-dysms-notification-channel/health.svg)](https://phpackages.com/packages/lizhineng-dysms-notification-channel)
```

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/discord

Laravel notification driver for Discord.

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

Laravel FCM (Firebase Cloud Messaging) Notification Channel

210964.1k1](/packages/benwilkins-laravel-fcm-notification)[laravel-notification-channels/rocket-chat

Rocket.Chat Notifications channel for Laravel 5.6+

1345.5k](/packages/laravel-notification-channels-rocket-chat)

PHPackages © 2026

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