Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fridolin-koch/vreshtwiliobundle
A Symfony2 wrapper for the official SDK provided by Twilio.
https://github.com/fridolin-koch/vreshtwiliobundle
bundle php symfony symfony-bundle twilio
Last synced: 3 months ago
JSON representation
A Symfony2 wrapper for the official SDK provided by Twilio.
- Host: GitHub
- URL: https://github.com/fridolin-koch/vreshtwiliobundle
- Owner: fridolin-koch
- License: mit
- Archived: true
- Created: 2013-04-04T19:58:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-10-19T18:31:33.000Z (about 7 years ago)
- Last Synced: 2024-09-29T08:22:54.890Z (3 months ago)
- Topics: bundle, php, symfony, symfony-bundle, twilio
- Language: PHP
- Homepage:
- Size: 66.4 KB
- Stars: 45
- Watchers: 5
- Forks: 45
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
#Symfony2 Twilio Bundle - by [Fridolin Koch](http://fkse.io)
[![Build Status](https://travis-ci.org/fridolin-koch/VreshTwilioBundle.png?branch=master)](https://travis-ci.org/fridolin-koch/VreshTwilioBundle)
[![Coverage Status](https://coveralls.io/repos/github/fridolin-koch/VreshTwilioBundle/badge.svg?branch=master)](https://coveralls.io/github/fridolin-koch/VreshTwilioBundle?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fridolin-koch/VreshTwilioBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/fridolin-koch/VreshTwilioBundle/?branch=master)
About
-----This is just a wrapper for the [official SDK](https://github.com/twilio/twilio-php) provided by [Twilio](http://www.twilio.com/).
Installation
------------Add this to your `composer.json` file:
```json
"require": {
"vresh/twilio-bundle": "dev-master",
}
```Add the bundle to `app/AppKernel.php`
```php
$bundles = array(
// ... other bundles
new Vresh\TwilioBundle\VreshTwilioBundle(),
);
```Configuration
-------------Add this to your `config.yml`:
```yaml
vresh_twilio:
#(Required) Your Account SID from www.twilio.com/user/account
sid: 'XXXXXXXX'
#(Required) Your Auth Token from www.twilio.com/user/account
authToken: 'YYYYYYYY'
#(Optional, default: '2010-04-01') Twilio API version
version: '2010-04-01'
#(Optional, default: 1) Number of times to retry failed requests
retryAttempts: 3
```Usage
-----Provided services:
| Service | Class |
|---------------------|-------------------------------|
| `twilio.api` | `\Services_Twilio` |
| `twilio.capability` | `\Services_Twilio_Capability` |
| `twilio.lookups` | `\Lookups_Services_Twilio` |Inside a controller:
```php
class TelephoneController extends Controller
{
public function callAction($me, $maybee)
{
//returns an instance of Vresh\TwilioBundle\Service\TwilioWrapper
$twilio = $this->get('twilio.api');$message = $twilio->account->messages->sendMessage(
'+14085551234', // From a Twilio number in your account
'+12125551234', // Text any number
"Hello monkey!"
);//get an instance of \Service_Twilio
$otherInstance = $twilio->createInstance('BBBB', 'CCCCC');return new Response($message->sid);
}
}
```Inside a console command:
```php
class SomeCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('some:comand')
->setDescription('A command')
;
}protected function execute(InputInterface $input, OutputInterface $output)
{
//returns an instance of Vresh\TwilioBundle\Service\TwilioWrapper
$twilio = $this->getContainer()->get('twilio.api');$message = $twilio->account->messages->sendMessage(
'+14085551234', // From a Twilio number in your account
'+12125551234', // Text any number
"Hello monkey!"
);//get an instance of \Service_Twilio
$otherInstance = $twilio->createInstance('BBBB', 'CCCCC');print $message->sid;
}
}
```Copyright / License
-------------------See [LICENSE](https://github.com/fridolin-koch/VreshTwilioBundle/blob/master/LICENSE)