dev-master
9999999-dev https://github.com/tehplague/symfony-sms-bundleSymfony SMS bundle
GPL
The Requires
- php >=5.3.2
sms notification
Wallogit.com
2017 © Pedro Peláez
Symfony SMS bundle
Symfony2 bundle for supporting SMS, (*1)
In your AppKernel:, (*2)
new cspoo\SmsBundle\cspooSmsBundle(),
# config.yml
cspoo_sms:
default_transport: winic
transports:
-
name: winic
type: winic
username: foo
password: bar
$smsSender = $this->container->get('sms');
$sms = $smsSender->createSms($phone, $token);
$smsSender->sendSms($sms);
If you have a provider that needs a username/password you can simply add it by doing these steps, (*3)
In the Transport folder add a classe MyOwnTransport.php and put in it, (*4)
<?php
namespace cspoo\SmsBundle\Transport;
use cspoo\SmsBundle\Model\Sms;
class WinicTransport extends BaseTransport
{
public function getName()
{
return 'name of the provider';
}
public function sendSms(Sms $sms)
{
$id = urlencode($this->getUsername());
$password = urlencode($this->getPassword());
$to = urlencode($sms->getRecipient());
$content = urlencode($sms->getMessage());
// your provider specific code
// return whatever you want
return 42;
}
}
In the Services folder you can edit SmsFactory.php to populate the loadTransport method with your new class, (*5)
In DependencyInjection/Configuration.php you can provider name in the list of possible entry, (*6)
Symfony SMS bundle
GPL
sms notification