PHPackages                             taiwan-sms/twsms - 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. taiwan-sms/twsms

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

taiwan-sms/twsms
================

台灣簡訊 twsms api client

v1.0.7(3y ago)17281MITPHPPHP &gt;=5.5.9

Since Dec 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/taiwan-sms/twsms)[ Packagist](https://packagist.org/packages/taiwan-sms/twsms)[ RSS](/packages/taiwan-sms-twsms/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (13)Versions (3)Used By (0)

TwSMS notifications channel for Laravel 5.3+
============================================

[](#twsms-notifications-channel-for-laravel-53)

[![StyleCI](https://camo.githubusercontent.com/5be627845c5804479e75aec786ce1944d8e6df82e870b608a9a6d8fb2e81d3fd/68747470733a2f2f7374796c6563692e696f2f7265706f732f38333736303332372f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/83760327)[![Build Status](https://camo.githubusercontent.com/8c899c65c0fc2eb4b3ac2c87cc4d9f801e76dfb9c0961e6a44724cabea2a9b76/68747470733a2f2f7472617669732d63692e6f72672f74616977616e2d736d732f7477736d732e737667)](https://travis-ci.org/taiwan-sms/twsms)[![Total Downloads](https://camo.githubusercontent.com/7837a985f319eaa0511b37088360a729322b197f5fbfe0ff38a527642c2e1d93/68747470733a2f2f706f7365722e707567782e6f72672f74616977616e2d736d732f7477736d732f642f746f74616c2e737667)](https://packagist.org/packages/taiwan-sms/twsms)[![Latest Stable Version](https://camo.githubusercontent.com/4e76ca4fb18fa0c71f019bfed7a2d6d1438643722511462b979d2710bc77503c/68747470733a2f2f706f7365722e707567782e6f72672f74616977616e2d736d732f7477736d732f762f737461626c652e737667)](https://packagist.org/packages/taiwan-sms/twsms)[![Latest Unstable Version](https://camo.githubusercontent.com/e6c34a72a8cb2e08775bbf6662f368b81516ec1151ebf28aa6d321b9988ecf21/68747470733a2f2f706f7365722e707567782e6f72672f74616977616e2d736d732f7477736d732f762f756e737461626c652e737667)](https://packagist.org/packages/taiwan-sms/twsms)[![License](https://camo.githubusercontent.com/a645b4245b3817542329609401861427d360cb250247ef8f161c5b25616a7125/68747470733a2f2f706f7365722e707567782e6f72672f74616977616e2d736d732f7477736d732f6c6963656e73652e737667)](https://packagist.org/packages/taiwan-sms/twsms)[![Monthly Downloads](https://camo.githubusercontent.com/47255dc4ded9036d8a15b81c43ddd113e0193773111b02fd4cd5a957e75a565b/68747470733a2f2f706f7365722e707567782e6f72672f74616977616e2d736d732f7477736d732f642f6d6f6e74686c79)](https://packagist.org/packages/taiwan-sms/twsms)[![Daily Downloads](https://camo.githubusercontent.com/b5fd52489e2e45a35ca69adaf7fc13c25ff9f9c72d7a65b43b0cb52a52fa6e46/68747470733a2f2f706f7365722e707567782e6f72672f74616977616e2d736d732f7477736d732f642f6461696c79)](https://packagist.org/packages/taiwan-sms/twsms)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/92c7d7f143f4263315cc5c98dbe595a18657e073f75c2ed400bdafda32ad7a3f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74616977616e2d736d732f7477736d732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/taiwan-sms/twsms/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/3acb23b1f8752598ce17726654e732c46f0340a27d0d75a02e4a7081ba5a29ea/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74616977616e2d736d732f7477736d732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/taiwan-sms/twsms/?branch=master)

This package makes it easy to send notifications using \[twsms\] with Laravel 5.3+.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the TwSMS service](#setting-up-the-TwSMS-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 taiwan-sms/twsms illuminate/notifications php-http/guzzle6-adapter
```

Then you must install the service provider:

```
// config/app.php
'providers' => [
    ...
    TaiwanSms\TwSMS\TwSMSServiceProvider::class,
],
```

### Setting up the TwSMS service

[](#setting-up-the-twsms-service)

Add your TwSMS login, secret key (hashed password) and default sender name (or phone number) to your `config/services.php`:

```
// config/services.php
...
'twsms' => [
    'username' => env('SERVICES_TWSMS_USERNAME'),
    'password' => env('SERVICES_TWSMS_PASSWORD'),
],
...
```

Usage
-----

[](#usage)

You can use the channel in your `via()` method inside the notification:

```
use TaiwanSms\TwSMS\TwSMSMessage;
use TaiwanSms\TwSMS\TwSMSChannel;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TwSMSChannel::class];
    }

    public function toTwSMS($notifiable)
    {
        return TwSMSMessage::create("Task #{$notifiable->id} is complete!");
    }
}
```

In your notifiable model, make sure to include a routeNotificationForTwSMS() method, which return the phone number.

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

### Available methods

[](#available-methods)

`content()`: Sets a content of the notification message.

`sendTime()`: Set send time of the notification message.

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)

- [JhaoDa](https://github.com/recca0120)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

API Only
========

[](#api-only)

```
composer require taiwan-sms/twsms php-http/guzzle6-adapter
```

How to use
----------

[](#how-to-use)

```
require __DIR__.'/vendor/autoload.php';

use TaiwanSms\TwSMS\Client;

$userId = 'xxx';
$password = 'xxx';

$client = new Client($userId, $password);

var_dump($client->credit()); // 取得額度
var_dump($client->send([
    'to' => '09xxxxxxxx',
    'text' => 'test message',
]));
/*
return [
    'code' => '00000',
    'text' => 'Success',
    'msgid' => '265078525',
];
*/
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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 ~363 days

Total

2

Last Release

1254d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1390554?v=4)[Recca Tsai](/maintainers/recca0120)[@recca0120](https://github.com/recca0120)

---

Top Contributors

[![recca0120](https://avatars.githubusercontent.com/u/1390554?v=4)](https://github.com/recca0120 "recca0120 (2 commits)")

---

Tags

laravelnotificationtwsmslaravelnotificationsmsTaiwantwsms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/taiwan-sms-twsms/health.svg)

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

###  Alternatives

[taiwan-sms/every8d

every8d sms api client

1817.8k](/packages/taiwan-sms-every8d)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)[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)
