Git Product home page Git Product logo

plivo's Introduction

Laravel - plivo

docs on web

WHAT IT IS?

  • This package is used to send sms to any mobile number.
  • This uses Plivo! API.
  • It requires AuthId and AuthToken, they can be generated by registering @at Plivo
    • after registrion click on Dashboard ,there you will be able to see authid and authtoken.
    • sample snapshot: Image of plivo dashboard

Version

1.2.4

Compatibility

Laravel version Plivo version
5.4 1.2.4
5.2 1.2.4
5.1 1.2.4
5.0 1.2.4
4.2 1.1.0

INSTALLATION

To install this package you will need:

  • Laravel 4 or 5 (see compatibility table)
  • PHP

Install via composer ( you can install this package issuing the following command from the terminal )

composer require lakshmaji/plivo

Laravel INTEGRATION

Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:

 Lakshmaji\Plivo\PlivoServiceProvider::class,

Next, also in the app.php config file, under the aliases array, you are required to add the Plivo facade.

'Plivo' => Lakshmaji\Plivo\Facade\Plivo::class,

Finally, you will want to publish the config using the following command:

	php artisan vendor:publish  

In the plivo.php configuration file we need to enter the Plivo API key and ID

Don't forget to set a auth id and auth secret keys in the config file!, you can get them at Plivo dashboard.

SENDING SMS

<?php

Use Plivo;

$params = array(
	'src' => '1111111111',
	'dst' => '91999999999',
	'text' => 'Hello world!'
);

Plivo::sendSMS($params);

Sent SMS history

<?php

Use Plivo;

// Lists all messages history
$list_all_messages = Plivo::allMessages();

// Lists the filtered messages (pagination)
$params = array(
	'limit' => 2,
	'offset' => 2,
	'message_direction' => 'inbound',
	'message_state' => 'delivered',
);
$list_some_messages = Plivo::allMessages($params);

Get Message data

<?php

Use Plivo;

// Lists all messages history
$list_all_messages = Plivo::allMessages();

// Lists the filtered messages (pagination)
$params = array(
	'limit' => 2,
	'offset' => 2,
	'message_direction' => 'inbound',
	'message_state' => 'delivered',
);
$list_some_messages = Plivo::allMessages($params);

MISCELLANEOUS

<?php

  Use Plivo;

  $params = array(
	  'country_iso' => 'IN'
  );
  
  // List the pricing plans available in a country by using country ISO code
  Plivo::pricing($params);

EXAMPLE CODE FOR Laravel

<?php 
// Define namespace
namespace App\Http\Controllers;

// Include required namespaces
use Illuminate\Routing\Controller as BaseController;
use Plivo;

class Controller extends BaseController
{
    public function sendSMS()
    {
		$params = array(
			'src' => '1111111111',
			'dst' => '91999999999',
			'text' => 'Hello world!'
		);
		
		$response = Plivo::sendSMS($params);
		
}

LICENSE

MIT

Todo

  • Need to add voice support

plivo's People

Contributors

drolean avatar lakshmaji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

plivo's Issues

Install Error

I'm trying to install this packpage but it returns the following error

Problem 1
- Conclusion: don't install lakshmajim/plivo 1.2.5
- Conclusion: don't install lakshmajim/plivo 1.2.4
- Conclusion: don't install lakshmajim/plivo 1.2.3
- Conclusion: don't install lakshmajim/plivo 1.2.2
- Conclusion: don't install lakshmajim/plivo 1.2.1
- Conclusion: remove laravel/framework v5.4.25
- Installation request for guzzlehttp/guzzle (locked at 5.3.1) -> satisfiable by guzzlehttp/guzzle[5.3.1].
- Installation request for lakshmajim/plivo ^1.2 -> satisfiable by lakshmajim/plivo[1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5].
- Conclusion: don't install laravel/framework v5.4.25
- lakshmajim/plivo 1.2.0 requires illuminate/support 4.2.* -> satisfiable by illuminate/support[v4.2.1, v4.2.12, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
- don't install illuminate/support v4.2.1|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.12|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.16|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.17|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.2|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.3|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.4|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.5|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.6|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.7|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.8|don't install laravel/framework v5.4.25
- don't install illuminate/support v4.2.9|don't install laravel/framework v5.4.25
- Installation request for laravel/framework (locked at v5.4.25, required as 5.4.*) -> satisfiable by laravel/framework[v5.4.25].

Any clue whats may going on?

Thanks :)

Messages are sent twice

Thanks for creating the plugin, it's a nice wrapper for the Plivo PHP package. I found a small bug in it. Currently all messages are sent twice because you call the send_message function twice (line 123 to 125 of plivo.php):

$response = $sendsms->send_message($params);
if($sendsms->send_message($params))

If you change the if statement so it takes the response as a result it will work better. The if statement also wasn't working (because you always got an object back it would always say it is sent successfully) so I changed the code to this:

$response = $sendsms->send_message($params);

        if($response["status"] == 202)
        {
            return "success";
        }
        else
        {
            return $response;
        }

Wrong information in document

Hello,
In document for laravel it is written to add following commands to the app.php:
IN PROVIDERS ARRAY lakshmajim\plivo\PlivoServiceProvider::class,
and
IN ALIASES ARRAY 'Plivo' => lakshmajim\plivo\Facade\Plivo::class,
these commands are not compatible with PSR4 and should be in this way:
IN PROVIDERS ARRAY Lakshmajim\Plivo\PlivoServiceProvider::class,
and
IN ALIASES ARRAY 'Plivo' => Lakshmajim\Plivo\Facade\Plivo::class,

Declaration of Response::toXML()

Declaration of Response::toXML() should be compatible with Element::toXML($header = false)

lines 760-768 (vendor/lakshmajim/plivo/src/Plivopackage/plivo.php)

    function __construct() {
        parent::__construct(NULL);
    }

    public function toXML() {
        $xml = Element::toXML($header=TRUE);
        return $xml;
    }

I can fix the error this method:

    public function toXML($header=TRUE) {
        $xml = parent::toXML($header);
        return $xml;
    }

Class 'Lakshmaji\Plivo\PlivoServiceProvider' not found

composer require lakshmaji/plivo
Using version dev-master for lakshmaji/plivo
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for lakshmaji/plivo dev-master -> satisfiable by lakshmaji/plivo[dev-master].
- lakshmaji/plivo dev-master requires plivo/plivo-php ^1.1 -> satisfiable by plivo/plivo-php[v1.1.0, v1.1.1, v1.1.2, v1.1.3, v1.1.4, v1.1.5, v1.1.6, v1.1.7] but these conflict with your requirements or minimum-stability.

Installation failed, reverting ./composer.json to its original content.

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.