GithubHelp home page GithubHelp logo

vgarciaf / sms-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from descom-es/sms-php

0.0 0.0 0.0 49 KB

Build your SMS application with PHP, easy SMS sending and worldwide coverage

PHP 100.00%

sms-php's Introduction

Build Status StyleCI Latest Stable Version Total Downloads License

PHP SMS sending

SMS Library for sending text messages to mobile numbers worldwide from your own application via Descom SMS gateway.

Create your free account at Descom SMS and buy credits for SMS sending when required.

Our API documentation is available here. Also, we will be happy to assist you at [email protected] for further info on your SMS project.

Installation

You can install it with composer:

composer require descom/sms-php

Usage

Send single SMS

This is an example:

$sms = new Sms(new AuthUser('your_username', 'your_password'));

$message = new Message();

$message->addTo('mobile_number')->setText('message_text');

$result = $sms->addMessage($message)
        ->setDryrun(true)
        ->send();

Send multiple SMS

You can send multiple SMS in one go, function addTo:

//...

$message->addTo('mobile_number_1')
        ->addTo('mobile_number_2');

//...

or with an Array:

//...

$message->addTo([
    'mobile_number_1',
    'mobile_number_2'
]);
//...

Check your account balance

The function getBalance allows you to check your SMS balance, this is your credit available. Example:

$sms = new Sms(new AuthUser('replace_by_your_usernme', 'replace_by_your_password'));

$balance = $sms->getBalance();

echo 'Your balance is '.$balance."\n";

Get list of senderID authorized

The function getSenderID allows you get the list of senderID authorized. Example:

$sms = new Sms(new AuthUser('replace_by_your_usernme', 'replace_by_your_password'));

$senderID = $sms->getSenderID();

echo 'Your balance is '.PHP_EOL;
print_r($senderID);

Setup your sender ID

Alphanumeric sender ID allows you to set your name or business brand as the sender ID. Use the function setSenderID at Descom\Sms\Message class

$message->setSenderID('replace_by_sender_of_message');

Note your sender ID should previously be added in your Descom SMS account setup.

Test your SMS sending application for free

Test your SMS sending application at no cost by using function setDryrun in the class Descom\Sms\Sms and set to true

$sms->setDryrun(true);

Dryrun just simulates SMS sending; no message will be sent out and no SMS credit will be deducted from your account.

Examples

Examples available at folder Examples.

sms-php's People

Contributors

cesargb avatar llorensjj avatar pilardescom avatar

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.