2017 © Pedro Peláez
 

library zenvia-php

Zenvia API 2.0 with your PHP application, build on top of the psr-7 components.

image

artesaos/zenvia-php

Zenvia API 2.0 with your PHP application, build on top of the psr-7 components.

  • Friday, March 18, 2016
  • by mauri870
  • Repository
  • 8 Watchers
  • 15 Stars
  • 121 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

Zenvia PHP

Build Status, (*1)

:warning: Under Development :construction:

Introduction

This package integrate the Zenvia SMS Gateway API 2.0 with your PHP application, built with PSR-7 in mind., (*2)

Table of Contents

Installation

Not work for now!, (*3)

This project follow the psr-7 standards and no have a dependency of an specific HTTP client. You need require a library for send the Http requests manually, at your choice. Consult this list to find a client that support php-http/client-implementation. For more information about virtual packages please refer to Httplug. Example:, (*4)

composer require php-http/guzzle6-adapter

Then install this package with composer:, (*5)

composer require artesaos/zenvia-php

Usage

First, see the Zenvia API Documentation for view the structure of requests and responses., (*6)

Sending SMS

The class you need use for sending sms is the Artesaos\Zenvia\SMS.php. Let`s get started sending one sms:, (*7)

$sms = new Artesaos\Zenvia\SMS('your_account','your_password');
$response = $sms->send(['id'=>'001','from'=>'sender','to'=>'phone_number',''msg'=>'message']);

The send method return for default a psr7 response, but you can choose the response type, passing a third argument to the send method. The second argument is a optional aggregateId parameter. The response type argument is a string and need to be one of: array,obj,string,stream,simple_xml or psr7(default). Example:, (*8)

$sms = new Artesaos\Zenvia\SMS('your_account','your_password');
$response = $sms->send(['id'=>'001','from'=>'sender','to'=>'phone_number','msg'=>'message'],'simple_xml');

If you need convert your psr7 response to one of the response types manually, see the changing a response format section., (*9)

Sending Multiple SMS

For sending multiple SMS at a time, use the sendMultiple method instead of send method:, (*10)

$messages = [
    [
        'id'=>'001',
        'from'=>'sender',
        'to'=>'phone_number'
        'msg'=>'message'
    ],
    [
        'id'=>'002',
        'from'=>'sender',
        'to'=>'phone_number'
        'msg'=>'message'
    ],
];
$sms = new Artesaos\Zenvia\SMS('your_account','your_password');
$response = $sms->send($messages);

Work in progress!, (*11)

License

This project is open-source and licensed under the MIT license, (*12)

The Versions

18/03 2016

dev-feature/convert_dates_to_carbon_obj

dev-feature/convert_dates_to_carbon_obj

Zenvia API 2.0 with your PHP application, build on top of the psr-7 components.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/03 2016