fourlabs / plivo-bundle
Plivo Bundle for Symfony - Send and receive text messages
Installs: 1 398
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
Requires
- php: >=7.0
- friendsofsymfony/rest-bundle: ^2.0
- guzzlehttp/guzzle: ~6.2
- misd/phone-number-bundle: ^1.3
- symfony/config: ~2.8|~3.0|~3.1
- symfony/dependency-injection: ~2.8|~3.0|~3.1
- symfony/event-dispatcher: ~2.8|~3.0|~3.1
- symfony/form: ~2.8|~3.0|~3.1
- symfony/http-foundation: ~2.8|~3.0|~3.1
- symfony/http-kernel: ~2.8|~3.0|~3.1
- symfony/options-resolver: ~2.8|~3.0|~3.1
- symfony/routing: ~2.8|~3.0|~3.1
This package is auto-updated.
Last update: 2024-12-22 07:58:46 UTC
README
Installation
Install with composer
$ composer require fourlabs/plivo-bundle eightpoints/guzzle-bundle
Add these bundles to app/AppKernel.php
<?php //... $bundles = [ // ... // FLPlivoBundle depends on GuzzleBundle and MisdPhoneNumberBundle // Add them if they're not already present in your $bundles new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle(), new Misd\PhoneNumberBundle\MisdPhoneNumberBundle(), new FL\PlivoBundle\FLPlivoBundle(), ];
Sample Configuration
app/config/config.yml
# Guzzle Configuration eight_points_guzzle: clients: plivo: # configure plivo client base_url: 'https://api.plivo.com/v1/Account/%plivo_auth_id%/' headers: Accept: "application/json" options: auth: - %plivo_auth_id% # user - %plivo_auth_token% # password timeout: 30 # Plivo Configuration fl_plivo: sms_incoming_class: AppBundle\Entity\SmsIncoming sms_outgoing_class: AppBundle\Entity\SmsOutgoing development_mode: true # if set to true, sms will not be sent - defaults to false
app/config/services.yml
guzzle.client.plivo: alias: eight_points_guzzle.client.plivo
app/config/routing.yml
fl_plivo: resource: "@FLPlivoBundle/Resources/config/routing.yml" prefix: /
Suggested Implementation
- Create an entity for your ORM/ODM (e.g. Doctrine) that extends \Plivo\Model\SmsIncoming
- Create an entity that extends \Plivo\Model\SmsOutgoing
- If you are using Doctrine, you can use the corresponding event listeners, by importing them.
# app/config/config.yml imports: - { resource: "@FLPlivoBundle/Resources/config/event-listener/doctrine.yml"}
- If you are using not using Doctrine, create your own event listeners and submit a pull request ;)
- To receive SMS messages, follow the instructions from Plivo
- Use the corresponding url for the route
fl_plivo.post_message
(If you imported the default routing file, without a prefix, this would be /api/v1.0/message)
License
PlivoBundle is licensed under the MIT license.