dev-master
9999999-devBundle for sending SMS messages
proprietary
The Requires
- php >=5.4
- smsapi.pl/php-client ~1.6
The Development Requires
by Dominik Kasprzak
bundle sms
Wallogit.com
2017 © Pedro Peláez
Bundle for sending SMS messages
Extensible Symfony2 bundle for sending simple SMS messages., (*1)
The bundle is available via composer, simply call composer require progrupa/sms-bundle:dev-master or add "progrupa/sms-bundle": "dev-master" to your composer.json and then call composer update progrupa/sms-bundle., (*2)
Then enable the bundle in your AppKernel.php:, (*3)
new Progrupa\SmsBundle\ProgrupaSmsBundle()
# config.yml
progrupa_sms:
transport: 'smsapi.pl'
$result = $this->get('progrupa.sms')->send('48111222333', 'Text message');
if ($result->isSuccess) {
echo "SMS was sent";
}
The bundle provides support for SmsApi.pl messaging service. To use it, You'll need to provide credentials of an active account. This is done through bundle configuration:, (*4)
progrupa_sms:
smsapi_pl:
username: YourUsername
password: YourPassword
options:
from: Awesome Co
encoding: utf-8
The options section allows to specify any options You wish to pass with send action. Full documentation can be found
on the provider's website, (*5)
To support your own SMS provider You need to create a TransportInterface class, declare it as a service and tag with progrupa.sms.transport.
Then configure Progrupa Sms Bundle to use Your transport instead of the default one., (*6)
Example transport:, (*7)
use Progrupa\SmsBundle\Model\Result;
use Progrupa\SmsBundle\Model\Sms;
use Progrupa\SmsBundle\Transport\TransportInterface;
class MyAwesomeTransport implements TransportInterface
{
/**
* @param Sms $sms Message to be sent
* @return Result
*/
public function send(Sms $sms)
{
$result = $this->magic->sendSMS($sms->recipient, $sms->message);
return $result;
}
}
Example service configuration:, (*8)
<service id="foo.my_awesome_transport" class="MyAwesomeTransport">
<arguments>...</arguments>
<tag name="progrupa.sms.transport" alias="my_awesome_transport" />
</service>
or, (*9)
services:
foo.my_awesome_transport:
class: MyAwesomeTransport
tags:
- {name: "progrupa.sms.transport", alias: "my_awesome_transport"}
Example configuration:, (*10)
# config.yml
progrupa_sms:
transport: 'my_awesome_transport'
We are open to pull requests providing new transport support or new features, feel free to contact us., (*11)
Bundle for sending SMS messages
proprietary
bundle sms