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

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

creativecrafts/laravel-twillio-sms
==================================

A simple package to send sms messages using twillio

1.3.1(1y ago)1583[4 PRs](https://github.com/CreativeCrafts/laravel-twillio-sms/pulls)MITPHPPHP ^8.3|^8.2CI passing

Since Aug 9Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/CreativeCrafts/laravel-twillio-sms)[ Packagist](https://packagist.org/packages/creativecrafts/laravel-twillio-sms)[ Docs](https://github.com/creativecrafts/laravel-twillio-sms)[ RSS](/packages/creativecrafts-laravel-twillio-sms/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (17)Used By (0)

A simple package to send sms messages using twillio
===================================================

[](#a-simple-package-to-send-sms-messages-using-twillio)

[![Latest Version on Packagist](https://camo.githubusercontent.com/35ee33414c7ef4d7406e4c23ae95cc27d240ab2c4e78baa9ee3ac50227ff2815/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63726561746976656372616674732f6c61726176656c2d7477696c6c696f2d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/creativecrafts/laravel-twillio-sms)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f76f20ef9ccab62a503c481b589968afbb149dbc03c86b0ae860f7495191a8c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63726561746976656372616674732f6c61726176656c2d7477696c6c696f2d736d732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/creativecrafts/laravel-twillio-sms/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3a1debd2ccac8855752cd873ded96b76de1b518c75fabf097b8d94e9a51ed4ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63726561746976656372616674732f6c61726176656c2d7477696c6c696f2d736d732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/creativecrafts/laravel-twillio-sms/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9bf3b278f0cee6096838234d07e7628fbfdb57d7b982c5b2c947d10eb72f3a60/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63726561746976656372616674732f6c61726176656c2d7477696c6c696f2d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/creativecrafts/laravel-twillio-sms)

Laravel Twilio SMS
==================

[](#laravel-twilio-sms)

Laravel Twilio SMS is a simple, elegant package for sending SMS messages using the Twilio API within your Laravel applications. This package allows you to validate phone numbers and send SMS messages effortlessly.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Method Reference](#method-reference)
- [Testing](#testing)
- [License](#license)

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

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.x or higher

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

[](#installation)

You can install the package via Composer:

```
composer require creativecrafts/laravel-twillio-sms
```

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

[](#configuration)

After installing the package, you need to publish the configuration file:

```
php artisan vendor:publish --tag="twillio-sms-config"
```

This will create a config/twillio-sms.php file where you can set up your Twilio credentials:

```
return [
    'account_sid' => env('TWILIO_ACCOUNT_SID'),
    'auth_token' => env('TWILIO_AUTH_TOKEN'),
    'sms_from' => env('TWILIO_SMS_FROM'),
    // The Lookup v2 API allows you to query information on a phone number so that you can make a trusted interaction with your user.
    // With this, you can format and validate phone numbers with the free Basic Lookup request
    // and add on data packages to get even more in-depth carrier and caller information.
    // currently supported fields: 'line_type_intelligence', 'sms_pumping_risk' for more information
    'phone_number_lookup' => [
        'fields' => [
            'line_type_intelligence',
            'sms_pumping_risk',
        ],
        'sms_pumping_risk' => [
            // low risk: 0 - 59
            // mild risk: 60 - 74
            // moderate risk: 75 - 89
            // high risk: 90 - 100
            // visit https://www.twilio.com/docs/lookup/v2-api/sms-pumping-risk for more information
            'max_allowed_sms_pumping_risk_score' => 59,
        ],
    ],
];
```

Ensure you have the following environment variables set in your .env file:

```
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_SMS_FROM=your_twilio_phone_number
```

Usage
-----

[](#usage)

To send an SMS, you can create an instance of the LaravelTwillioSms class and chain the methods to set the recipient’s phone number, the message content, and the sender’s number.

Example

```
use CreativeCrafts\LaravelTwillioSms\LaravelTwillioSms;

$sms = LaravelTwillioSms::init()
    ->setPhoneNumber('+1234567890')
    ->setMessage('Hello, this is a test message!')
    ->send();

if ($sms) {
    echo "Message sent successfully!";
} else {
    echo "Failed to send the message.";
}
```

Method Reference
----------------

[](#method-reference)

### init()

[](#init)

```
public static function init(): self
```

Creates a new instance of the LaravelTwillioSms class.

### setFrom(string $from): self

[](#setfromstring-from-self)

Sets the ‘from’ phone number for the SMS messages.

### setPhoneNumber(string $number): self

[](#setphonenumberstring-number-self)

Sets the recipient’s phone number for the SMS message.

### setMessage(string $message): self

[](#setmessagestring-message-self)

Sets the content of the SMS message.

### send(): bool

[](#send-bool)

Sends the SMS message. Returns true if the message is sent successfully, or throws a TwilioException if an error occurs.

### sendSms(string $number, string $message): bool

[](#sendsmsstring-number-string-message-bool)

### - Deprecated. Use send() instead. This method sends an SMS using the provided number and message directly.

[](#--deprecated-use-send-instead-this-method-sends-an-sms-using-the-provided-number-and-message-directly)

### Getters

[](#getters)

```
•	getPhoneNumber(): string
•	getMessage(): string
•	getSentFrom(): string

```

### validatePhoneNumber(): bool

[](#validatephonenumber-bool)

Validates the recipient’s phone number using Twilio’s Lookup API.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Godspower Oduose](https://github.com/rockblings)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance63

Regular maintenance activity

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 89.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 ~52 days

Recently: every ~88 days

Total

12

Last Release

436d ago

Major Versions

0.0.7 → 1.0.02024-03-17

PHP version history (3 changes)0.0.1PHP ^8.2

0.0.5PHP ^8.1

1.3.1PHP ^8.3|^8.2

### Community

Maintainers

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

---

Top Contributors

[![rockblings](https://avatars.githubusercontent.com/u/5190259?v=4)](https://github.com/rockblings "rockblings (60 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelcreativeCraftslaravel-twillio-smslaravel-send-sms

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

482458.3k1](/packages/xammie-mailbook)[spatie/laravel-notification-log

Log notifications sent by your Laravel app

207902.8k](/packages/spatie-laravel-notification-log)[wnx/laravel-sends

Keep track of outgoing emails in your Laravel application.

200427.3k](/packages/wnx-laravel-sends)[spatie/laravel-discord-alerts

Send a message to Discord

151408.0k](/packages/spatie-laravel-discord-alerts)[backstage/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24157.5k5](/packages/backstage-laravel-mails)

PHPackages © 2026

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