Ok, well this is really doing my head in! I am trying to integrate Twilio with a Symfony2 site, and I found a bundle which apparently fits into the framework here: https://github.com/fridolin-koch/VreshTwilioBundle however, the main Twilio framework needed to be downloaded separately and the structure is not in keeping with Symfony2, in the sense that class names are different and there are no namespaces included. I installed the package via composer which seemed to work but I constantly get errors like this:
The autoloader expected class "Vresh\TwilioBundle\Services_Twilio" to be defined in file "/Applications/MAMP/htdocs/my_site_name/src/Vresh/TwilioBundle/Services/Twilio.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
And even with the correct namespace declared, I cannot get it to work. I feel that I'm going round in circles editing classes and changing code which I do not really know; if anyone else has managed to successfully integrated Twilio with Symfony2 I would appreciate any tips or help! Even the Twilio help desk know nothing about Symfony!
Thank you in advance Michael
We are successfully using Twilio. But we did not have to download it separately. VreshTwilioBundle
is a wrapper that makes twilio/sdk
available inside of Symfony
. All we did was:
add this to the composer.json
"require": {
"vresh/twilio-bundle": "dev-master",
}
enable it in AppKernel.php
$bundles = array(
// ... other bundles
new Vresh\TwilioBundle\VreshTwilioBundle(),
);
add configuration to config.yml
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: '2008-08-01'
#(Optional, default: 1) Number of times to retry failed requests
retryAttempts: 3
Basically, we just followed instructions for installing VreshTwilioBundle
. This bundle adds twilio/sdk
package as its requirement, so twilio/sdk
is automatically downloaded when you run composer update.
That is all we had to do. Then, twilio/sdk
is available as a service through container:
$twilio = $this->get('twilio.api');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With