PHPackages                             toucantext/php-sdk - 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. toucantext/php-sdk

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

toucantext/php-sdk
==================

The ToucanText PHP SDK is a simple to use interface to help you send and retrieve messages quickly and efficiently.

1.1(7y ago)09PHPPHP &gt;=5.5.0

Since Jan 29Pushed 7y agoCompare

[ Source](https://github.com/ToucanText/php-sdk)[ Packagist](https://packagist.org/packages/toucantext/php-sdk)[ RSS](/packages/toucantext-php-sdk/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

[![ToucanText](https://camo.githubusercontent.com/1925b46806c305793a0e99bb3c0e5f3abc5bcc4467e044445391788251d15f25/68747470733a2f2f7777772e746f7563616e746578742e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031382f31302f546f7563616e546578742d4c6f676f2e737667)](https://camo.githubusercontent.com/1925b46806c305793a0e99bb3c0e5f3abc5bcc4467e044445391788251d15f25/68747470733a2f2f7777772e746f7563616e746578742e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031382f31302f546f7563616e546578742d4c6f676f2e737667)

ToucanText PHP SDK
==================

[](#toucantext-php-sdk)

*This library requires a minimum PHP version of 5.5*

This is the PHP SDK library to use ToucanText's API. To use this, you'll need a ToucanText account and have access to your API credentials. Sign up for your [free trial at toucantext.com](https://www.toucantext.com/sign-up/).

- [Installation](#installation)
- [Usage](#usage)
- [Examples](#examples)
- [Coverage](#api-coverage)

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

[](#installation)

To use the PHP SDK, [create a ToucanText account](https://www.toucantext.com/sign-up/).

To install the PHP client to your project, we recommend using [Composer](https://getcomposer.org).

```
composer requiure toucantext/php-sdk
```

> You don't need to clone this repository to use the library in your own projects, you can use Composer to install it from Packagist.

If you're new to Composer, here are some resources that you may find useful:

- [Composer's Getting Started page](https://getcomposer.org/doc/00-intro.md) from Composer project's documentation
- [A Beginner's Guide to Composer](https://scotch.io/tutorials/a-beginners-guide-to-composer) from ScotchBox

Instantiating the SDK Client
----------------------------

[](#instantiating-the-sdk-client)

Pass in the configuration to the client:

```
$config = [
  'username' => '{your_api_username}',
  'password' => '{your_api_password}'
];

$toucan = new ToucanText\Client($config);
```

**Note:** If you are unsure what your 'api\_username' or 'api\_password' are, contact .

Using the Client
----------------

[](#using-the-client)

### Getting all messages

[](#getting-all-messages)

To return a list of all your messages (both inbound and delivery receipts):

```
// return all your messages
$toucan->messages->all();
```

By default, this returns a maximum of 25 messages but does NOT acknowledge them. To override this, pass the following parameters (the first denotes whether to acknowledge messages; the second for the maximum number of messages to return):

```
// return 15 messages maximum and acknowledge them
$toucan->messages->all(true, 15);
```

### Getting inbound messages or delivery receipts only

[](#getting-inbound-messages-or-delivery-receipts-only)

To return a list of inbound messages or delivery receipts:

```
// return only inbound messages
$toucan->messages->get('messagesOnly');

// return only delivery receipts
$toucan->messages->get('dlrsOnly');
```

By default, this returns a maximum of 25 inbound messages or delivery receipts but does **NOT** acknowledge them. To override this, pass the following parameters (the second denotes whether to acknowledge messages; the third for the maximum number of messages to return):

```
// return 15 inbound messages maximum and acknowledge them
$toucan->messages->get('messagesOnly', true, 15);

// return 15 delivery receipts maximum and acknowledge them
$toucan->messages->get('dlrsOnly', true, 15);
```

### Sending a message

[](#sending-a-message)

To send a message you, can call the following:

```
// send a message
$message = [
  'destinationAddress' => '{the_destination_address}',
  'message => '{your_message}'
];

$toucan->messages->send($message);
```

You can also set a source address and request a delivery receipt:

```
// send a message with source address and request delivery receipt
$message = [
  'sourceAddress' => '{your_source_address}',
  'destinationAddress' => '{the_destination_address}',
  'message' => '{your_message}',
  'deliveryReceipt' => true
];

$toucan->messages->send($message);
```

### Acknowledging delivery receipts and messages

[](#acknowledging-delivery-receipts-and-messages)

When you retrieve your inbound messages or delivery receipts, there is a MbStorageId element within the response of the query. This ID can be used to acknowledge messages and delivery receipts individually.

To acknowledge a message or delivery receipt create an array with the ID's to acknowledge and then call the following:

```
// array of message ID's to acknowledge
$messages = [
    245, 4564, 456
];

$toucan->messages->acknowledge($messages);
```

Handling Exceptions
-------------------

[](#handling-exceptions)

Aside from errors that may occur due to the call, there may be other Exceptions thrown. To handle them, wrap your call in a try catch block:

```
try {
  $toucan->messages->all();
} catch (Exception $e) {
  // do something with $e
}
```

License
-------

[](#license)

This library is released under the [MIT License](LICENSE.md).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

Total

2

Last Release

2644d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/10ea656efe85b3811e51d7ed24920e477b7a082dcf64868a25bd35baf3e23baf?d=identicon)[kjptoucan](/maintainers/kjptoucan)

---

Top Contributors

[![bensherred](https://avatars.githubusercontent.com/u/22666637?v=4)](https://github.com/bensherred "bensherred (16 commits)")

### Embed Badge

![Health badge](/badges/toucantext-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/toucantext-php-sdk/health.svg)](https://phpackages.com/packages/toucantext-php-sdk)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[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/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

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

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)

PHPackages © 2026

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