Giter VIP home page Giter VIP logo

plivobundle's Introduction

PlivoBundle

StyleCI Total Downloads License

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.

plivobundle's People

Contributors

foaly-nr1 avatar galeaspablo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

plivobundle's Issues

Status Webhook always flags delivered

The status webhook is called with the status of the message including "queued", "sent", "failed", "delivered", "undelivered" or "rejected". The correct status along with units and error code should be saved.

The URL to which with the status of the message is sent. The following parameters are sent to the URL:
To - Phone number of the recipient
From - Phone number of the sender
Status - Status of the message including "queued", "sent", "failed", "delivered", "undelivered" or "rejected"
...
Units - Number of units into which a long SMS was split
ErrorCode - Delivery Response code returned by the carrier attempting the delivery. See Supported error codes below.

https://www.plivo.com/docs/api/message/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.