ogizanagi / ovh-sms-bundle
Send sms through ovh SOAP API.
Installs: 241
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Open Issues: 0
pkg:composer/ogizanagi/ovh-sms-bundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: ~2.3
- symfony/options-resolver: ~2.3
This package is not auto-updated.
Last update: 2015-08-02 13:36:14 UTC
README
Description
Send sms through ovh SOAP API.
Installation
Add the following dependency to your composer.json file:
{
"require": {
"_other_packages": "...",
"ogizanagi/ovh-sms-bundle": "dev-master"
}
}
Run composer update for this package, and add the following lines to your AppKernel.php:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Ogi\OvhSmsBundle\OgiOvhSmsBundle(),
);
}
Configuration
#config.yml----------------------
#Sms OVH Soap API configuration:
ogi_ovh_sms:
soap_host: ~
login:
nic: yurnic-ovh
pass: p@ssw0rd
handle: fr
sms_account:
account: sms-yurnic-1
from: YURNAME
Usage
Once configured, you're ready to use the service:
$smsSenderFactory = $this->container->get('ogi.ovh_sms.factory.sms_sender');
$smsSender = $smsSenderFactory->getSmsSender();
$failed = [];
$smsConfig = SMSConfiguration::create(array(
'no_stop' => true,
'coding' => 2, //unicode
));
$phoneNumber = "+33606060606";
$sms = new SMS($phoneNumber, $message);
$result = $smsSender->sendSms($sms, $smsConfig, $failed);
See SMSConfiguration options for more infos about sms configuration.
NOTICE: The Ogi\OvhSmsBundle\Services\SmsSender class is only a wrapper around the Ogi\OvhSmsBundle\Services\APIClient class to handle the Ogi\OvhSmsBundle\Model\SMS and Ogi\OvhSmsBundle\Configuration\SMSConfiguration classes, and could also be used directly from the ogi.ovh_sms.factory.api_client service factory.
SMSConfiguration options
validity: Maximum time -in minute(s)- before the message is dropped, defaut is 48 hourssms_class: flash(0), phone display(1), SIM(2), toolkit(3) (constants availables)deferred: time -in minute(s)- to wait before sending the message, default is 0priority: the priority of the message (0 to 3), default is 3coding: sms coding : 1 for 7 bit or 2 for unicode, default is 1tag: optional tagno_stop: do not display STOP clause in the message. Only for non-advertising messages.
The SMSConfiguration class internally use the symfony/options-resolver component and could easily be extended to handle commonly used SMS types, overwriting the setDefaultOptions as needed.
Improvements
The following improvements could be made:
- Improve errors handling.
- Any other suggested improvements.