定制 scaytrase/symfony-sms-delivery-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

scaytrase/symfony-sms-delivery-bundle

最新稳定版本:2.1.5

Composer 安装命令:

composer require scaytrase/symfony-sms-delivery-bundle

包简介

Symfony Bundle SMS sending service

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Monthly Downloads Daily Downloads

This Symfony bundle provides basic service for sending short messages. This bundle does not provide you any finished implementation for communicating the SMS gateway. To use it you have use some transport implementation or implement a transport on your own. See usage section for known implementations

Features

Current features

  • Service and configurable transports
  • Ability to disable delivery via config for testing purposes
  • Ability to force redirect messages for testing purposes
  • Profiling via Sf2 Toolbar
  • Spooling and delayed sending

Planned features

  • Bulk sending

Installation

This bunde could be installed via Composer

composer require scaytrase/symfony-sms-delivery-bundle:~2.0

app/AppKernel.php

update your kernel bundle requirements as follows:

$bundles = array(
    //....
    new ScayTrase\SmsDeliveryBundle\SmsDeliveryBundle(),
    //....
    );

Configuration

Below is the configuration example and their default values

sms_delivery:
    spool: sms_delivery.spool.instant
    transport: sms_delivery.dummy_sender # @id of the transport service 
    disable_delivery: false # disable delivery overrides spool with disabled spool
    delivery_recipient: null # delivery recipient overrides recipient when sending

Usage

To use this interface you must create a message class implementing ShortMessageInterface and create the implementation of the TransportInterface that delivers your message to end point sms gateway. You can refer my WebSMS gateway implementation as a reference.

Example

class MyMessage implements ShortMessageInterface { /*...*/ }

class SmsController extends Controller {

  public function sendSmsAction()
  {
    $message = new MyMessage('5552368','Help!')
    $sender = $this->get('sms_delivery.sender');
    $sender->spoolMessage($message);
    $result = $sender->flush();
    return new Response('Delivery '. $result ? 'successful' : 'failed');
  }
}

Standalone usage

Despite of the fact that this library is designed as Symfony bundle it could be used as standalone library for sending short messages. You should just instantiate sender service on your own.

    class MyProviderSmsTransport implements TransportInterface { /*...*/ }

    class MyMessage implements ShortMessageInterface { /*...*/ }

    $transport = new MyProviderSmsTransport();
    $sender = new MessageDeliveryService($transport);
    $sender->spoolMessage(new MyMessage('Message body'));
    $sender->flush(); // Default InstantSpool does not actually needs flushing but you can use another spool instead

统计信息

  • 总下载量: 34.86k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固