PHPackages                             2amigos/yii2-twilio-component - 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. [API Development](/categories/api)
4. /
5. 2amigos/yii2-twilio-component

AbandonedArchivedYii2-extension[API Development](/categories/api)

2amigos/yii2-twilio-component
=============================

A Yii2 Application Component to ease the use of twilio SDK

1.0.0(8y ago)544.1k↑100%1[2 PRs](https://github.com/2amigos/yii2-twilio-component/pulls)BSD-3-ClausePHPPHP &gt;=7

Since Oct 27Pushed 3y ago2 watchersCompare

[ Source](https://github.com/2amigos/yii2-twilio-component)[ Packagist](https://packagist.org/packages/2amigos/yii2-twilio-component)[ RSS](/packages/2amigos-yii2-twilio-component/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Twilio Application Component for Yii2
=====================================

[](#twilio-application-component-for-yii2)

[![Latest Version](https://camo.githubusercontent.com/a0c0f5dea5b5c68f43b7676b097a916469f0ce56b96a7b5c60a39d21c11b13d1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f32616d69676f732f796969322d7477696c696f2d636f6d706f6e656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/2amigos/yii2-twilio-component/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/305aff1b014a11ebd8c7646de37c1da4749e83f6f7388e007bb69d3a570eaf6d/68747470733a2f2f706f7365722e707567782e6f72672f32616d69676f732f796969322d7477696c696f2d636f6d706f6e656e742f646f776e6c6f616473)](https://packagist.org/packages/2amigos/yii2-twilio-component)

[Twilio](https://www.twilio.com) is an awesome service that allows to include programmable SMS, Voice, Video, and Chat services in your apps. For Server side only Voice and SMS services are available.

This component is a simple wrapper to ease Yii2 framework developers the job to send SMS and start Voice calls with Twilio.

Install
-------

[](#install)

Via Composer

```
$ composer require 2amigos/yii2-twilio-component
```

Usage
-----

[](#usage)

### Sign up for a Twilio Account

[](#sign-up-for-a-twilio-account)

To use the [Twilio REST API](https://www.twilio.com/docs/api/rest), you need an account. [Signing up for a free Twilio account is easy](https://www.twilio.com/try-twilio). Once you've signed up, head over to your [Console](https://www.twilio.com/console) and grab your Account SID and your Auth Token.

### Purchase an SMS Capable Phone Number

[](#purchase-an-sms-capable-phone-number)

Sending SMS messages requires an SMS capable phone number. You can browse the available phone numbers in the Console. Be sure that the phone number you buy is SMS capable. When you search, you can check the box to filter available numbers to those that are SMS capable.

Once you have the Twilio phone number you are ready to configure your application component.

### Configuring the Component

[](#configuring-the-component)

You have to take the Account SID, the Auth Token and the purchased phone number and configure the component:

```
// On your application config file
// ...
'components' => [
    'twilio' => [
        'class' => '\dosamigos\twilio\TwilioComponent',
        'sid' => 'ACCOUNT_SID',
        'token' => 'AUTH_TOKEN',
        'phoneNumber' => 'PURCHASED_PHONE_NUMBER'
    ]
]
```

### Sending an SMS

[](#sending-an-sms)

Now that the application component has been set, you can do the following to send SMS:

```
$message = Yii::$app->twilio->sms('VALID_PHONE_NUMBER_TO_SEND_SMS', 'Hello World!');

// It returns a \Twilio\Rest\Api\V2010\Account\MessageInstance
echo $message->sid;
```

In case you wish to use another purchased phone number, you can override the one configured as follows:

```
$message = Yii::$app->twilio->sms('VALID_PHONE_NUMBER_TO_SEND_SMS', 'Hello World!', [
 'from' => 'ANOTHER_PURCHASED_TWILIO_PHONE_NUMBER'
]);

// It returns a \Twilio\Rest\Api\V2010\Account\MessageInstance
echo $message->sid;
```

Using code fixer
----------------

[](#using-code-fixer)

We have added a PHP code fixer to standardize our code. It includes Symfony, PSR2 and some contributors rules.

```
./vendor/bin/php-cs-fixer fix ./src --config .php_cs
```

Why there are no tests?
-----------------------

[](#why-there-are-no-tests)

The component is too simple to include tests as its a wrapper to Twilio's client library and the library has already all the required tests to check the functionality.

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

[](#contributing)

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

Credits
-------

[](#credits)

- [2amigos](https://github.com/2amigos)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

> [![](https://camo.githubusercontent.com/9fd8f1de41dc23003bb2a54034cb6658dde5be97092e195a62d629d0d7fa7f6c/687474703a2f2f7777772e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165302e706e67)](http://www.2amigos.us)
>  *Custom Software | Web &amp; Mobile Development*
>  [www.2amigos.us](http://www.2amigos.us)

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Unknown

Total

1

Last Release

3119d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/566016?v=4)[Antonio Ramirez](/maintainers/tonydspaniard)[@tonydspaniard](https://github.com/tonydspaniard)

---

Top Contributors

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

---

Tags

smstwilioyii2yiiyii 2voice2amigosyii framework

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/2amigos-yii2-twilio-component/health.svg)

```
[![Health](https://phpackages.com/badges/2amigos-yii2-twilio-component/health.svg)](https://phpackages.com/packages/2amigos-yii2-twilio-component)
```

###  Alternatives

[2amigos/yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension

298275.5k14](/packages/2amigos-yii2-usuario)

PHPackages © 2026

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