morannon / morannon-bundle
Symfony2 Bundle for Morannon SMS Gateway.
Installs: 9 694
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- morannon/morannon: ~0.1
- symfony/framework-bundle: ~2.3
Requires (Dev)
- phpunit/phpunit: ~4.4
This package is not auto-updated.
Last update: 2020-01-24 16:43:17 UTC
README
Supported services
Included service implementations:
- Nexmo
- WhateverMobile
- more to come!
Installation
Add morannon-bundle to your composer.json file:
"require": { "morannon/morannon-bundle": "~0.1" }
Use composer to install this package.
$ composer update morannon/morannon-bundle
Registering the Bundle
Register the bundle in your app/AppKernel.php
:
new \Morannon\Bundle\MorannonBundle\MorannonBundle(),
Configuration
Now add required config to app/config/config.yml
:
morannon: gateways: nexmo: api_base_url: https://rest.nexmo.com api_user: thisismyapiuser api_token: thisismyapitoken
Nexmo is used as an example here. Replace it with whatever your want. Now add all the resource owners you need, the services are created automatically.
Services
Services will be created automatically by this bundle. In my case, i want the xing service:
$service = $this->container->get('morannon.gateways.nexmo');
or inject it into another service:
fancy_company.random_namespace.wayne_bundle: class: FancyCompany\Bundle\WayneBundle\MyCool\ClassFor\WorldDominance arguments: - @morannon.gateways.nexmo
Usage
For type hinting the service use the \Morannon\Base\Gateway\GatewayInterface
interface, which provides the sendSMS
method.
This interface can also be used as type hinting in method and constructor signatures.
sending a sms
The sendSMS
method expects an instance of the Morannon\Base\SMS\SMSInterface
interface.
If you du not need any special magic, you could easily use the Morannon\Base\SMS\BaseSMS
implementation.
It returns an instance of Morannon\Base\Response\SentResponseInterface
interface which provides information about
the sent sms (e.g. getSentMessagesCount(), getMessageId()).