承接 progrupa/sms-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

progrupa/sms-bundle

Composer 安装命令:

composer require progrupa/sms-bundle

包简介

Bundle for sending SMS messages

关键字:

README 文档

README

Extensible Symfony2 bundle for sending simple SMS messages.

Installation

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.

Then enable the bundle in your AppKernel.php:

    new Progrupa\SmsBundle\ProgrupaSmsBundle()

Basic configuration

# config.yml
progrupa_sms:
    transport: 'smsapi.pl'

Usage

    $result = $this->get('progrupa.sms')->send('48111222333', 'Text message');
    if ($result->isSuccess) {
        echo "SMS was sent";
    }

Default provider

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:

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

Custom transport

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.

Example transport:

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:

    <service id="foo.my_awesome_transport" class="MyAwesomeTransport">
        <arguments>...</arguments>
        <tag name="progrupa.sms.transport" alias="my_awesome_transport" />
    </service>

or

services:
    foo.my_awesome_transport:
        class: MyAwesomeTransport
        tags:
            - {name: "progrupa.sms.transport", alias: "my_awesome_transport"}

Example configuration:

# config.yml
progrupa_sms:
    transport: 'my_awesome_transport'

Contributions

We are open to pull requests providing new transport support or new features, feel free to contact us.

统计信息

  • 总下载量: 51
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2015-11-04