2017 © Pedro Peláez
 

library php-ovh-sms

SDK for OVH SMS APIs

image

ovh/php-ovh-sms

SDK for OVH SMS APIs

  • Wednesday, July 13, 2016
  • by ovh
  • Repository
  • 6 Watchers
  • 37 Stars
  • 31,658 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 21 Forks
  • 9 Open issues
  • 4 Versions
  • 13 % Grown

The README.md

PHP OVH SMS

Send SMS directly from your code using OVH SMS offer., (*1)

getAccounts());
?>

Install

To download this SDK and integrate it inside your PHP application, you can use Composer., (*2)

Add the repository in your composer.json file or, if you don't already have this file, create it at the root of your project with this content:, (*3)

{
    "name": "Example Application",
    "description": "This is an example of OVH SMS APIs SDK usage",
    "require": {
        "ovh/php-ovh-sms": "dev-master"
    }
}

Then, you can install OVH SMS APIs SDK and dependencies with:, (*4)

php composer.phar install

This will install ovh/php-ovh-sms to ./vendor, along with other dependencies including autoload.php., (*5)

Configure

To use this SDK, you'll need API credentials. API credentials allows you to log in and manage OVH products without ever storing your password., (*6)

Even better, the credentials can be configured to only allow access on some specific features. In this case, we only want the script to access the SMS features., (*7)

To generate credentials to access all the SMS features, you can simply visit https://api.ovh.com/createToken/index.cgi?GET=/sms&GET=/sms/&PUT=/sms/&DELETE=/sms/&POST=/sms/, (*8)

And then use the generated credentials in you application., (*9)

For more advanced use cases, please consult the php-ovh or python-ovh wrappers., (*10)

Send a test message without specifying a sender using php-ovh-sdk

This example will create a new SDK instance, configure it to send a message to a french number without declaring a sender (a random shortcode will be used). It will then use this instance to plan a message in the future using the first account it finds., (*11)

To avoid consuming any credit accidentally, it will delete the message before actually sending it., (*12)

getAccounts();

// Set the account you will use
$Sms->setAccount($accounts[0]);

// Create a new message that will allow the recipient to answer (to FR receipients only)
$Message = $Sms->createMessage(true);
$Message->addReceiver("+33601020304");
$Message->setIsMarketing(false);

// Plan to send it in the future
$Message->setDeliveryDate(new DateTime("2018-02-25 18:40:00"));
$Message->send("Hello world!");

// Get all planned messages
$plannedMessages = $Sms->getPlannedMessages();

// Delete all planned messages
foreach ($plannedMessages as $planned) {
    $planned->delete();
}
?>https://api.ovh.com/createToken/index.cgi

Send a test message by using a beforehand declared sender

This example will create a new SDK instance, configure it to send a message. It will then use this instance to plan a message in the future using the first account it finds and the first sender it finds in the account as the message sender., (*13)

To avoid consuming any credit accidentally, it will delete the message before actually sending it., (*14)

getAccounts();

// Set the account you will use
$Sms->setAccount($accounts[0]);

// Get declared senders
$senders = $Sms->getSenders();

// Create a new message
$Message = $Sms->createMessage();
$Message->setSender($senders[0]);
$Message->addReceiver("+33601020304");
$Message->setIsMarketing(false);

// Plan to send it in the future
$Message->setDeliveryDate(new DateTime("2018-02-25 18:40:00"));
$Message->send("Hello world!");

// Get all planned messages
$plannedMessages = $Sms->getPlannedMessages();

// Delete all planned messages
foreach ($plannedMessages as $planned) {
    $planned->delete();
}
?>https://api.ovh.com/createToken/index.cgi

Hacking

Get the code:, (*15)

$ git clone https://github.com/ovh/php-ovh-sms.git
$ cd php-ovh-sms

Submit your changes:, (*16)

$ git commit -sam "change some feature because it makes my life easier"
$ git push

And visit Github to submit your change! https://github.com/ovh/php-ovh-sms/pulls, (*17)

  • Order SMS credit: https://www.ovhtelecom.fr/sms/
  • Get API credentials: https://api.ovh.com/createToken/index.cgi
  • Contribute: https://github.com/ovh/php-ovh-sms
  • Report bugs: https://github.com/ovh/php-ovh-sms/issues
  • Official OVH PHP wrapper: https://github.com/ovh/php-ovh

Licence

3-Clause BSD, (*18)

The Versions

13/07 2016

dev-master

9999999-dev

SDK for OVH SMS APIs

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

13/07 2016

1.0

1.0.0.0

SDK for OVH SMS APIs

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

13/05 2016

dev-doc

dev-doc

SDK for OVH SMS APIs

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

21/04 2016

dev-jt-readme

dev-jt-readme

SDK for OVH SMS APIs

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires