定制 avtonom/sms-devinotelecom-bundle 二次开发

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

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

avtonom/sms-devinotelecom-bundle

Composer 安装命令:

composer require avtonom/sms-devinotelecom-bundle

包简介

DevinoTelecom provider to send SMS notifications for Symfony2 bundle for PHP

README 文档

README

Provider to send SMS notifications for Symfony2 bundle for PHP by Devino Telecom (devinotele.com). Use KPhoenSmsSenderBundle for Symfony and Carpe-Hora/SmsSender.

Page bundle: https://github.com/Avtonom/sms-devinotelecom-bundle

Features

  • Get the session ID (receiving the token, authorization)
  • Sending a single SMS message (without taking into account the recipient's time zone)
  • Getting user balance
  • Validation of input data through a standard functional forms.

Maybe in the future:

  • Security (blocking) from overly frequent messaging.

HttpAdapters

HttpAdapters are responsible to get data from remote APIs.

Currently, there are the following adapters:

  • CurlHttpAdapter for cURL; (recommended)
  • BuzzHttpAdapter for Buzz, a lightweight PHP 5.3 library for issuing HTTP requests; (For additional installation of this dependence)

To Install

Run the following in your project root, assuming you have composer set up for your project

composer.phar require avtonom/sms-devinotelecom-bundle ~1.1

Switching ~1.1 for the most recent tag.

Add the bundle to app/AppKernel.php

$bundles(
    ...
       new KPhoen\SmsSenderBundle\KPhoenSmsSenderBundle(),
       new Avtonom\Sms\DevinoTelecomBundle\AvtonomSmsDevinoTelecomBundle(),
    ...
);

Configuration options (config.yaml):

k_phoen_sms_sender:
    pool:         ~   # right now, only "memory" is supported
    providers:    [devinotelecom]
    factories:    [ "%kernel.root_dir%/../vendor/avtonom/sms-devinotelecom-bundle/Avtonom/Sms/DevinoTelecomBundle/Resources/config/provider_factories.xml" ]

    devinotelecom:
        login:     %sms.provider.devinotelecom.login%
        password:  %sms.provider.devinotelecom.password%
        originators:  %sms.provider.devinotelecom.originators%

Configuration options (parameters.yaml):

parameters:
    sms.provider.devinotelecom.login: ~
    sms.provider.devinotelecom.password: ~
    sms.provider.devinotelecom.originators: [] # Leave an empty array if there is no strict checking the sender's name
    

Create a logger named "avtonom_sms.logger". Sample code (services.yml):

services:
    avtonom_sms.logger:
        public: true
        class: Symfony\Bridge\Monolog\Logger
        arguments: [sms]
    

Use

try {
    $sendResult = $this->get('sms.sender')->send('0642424242', 'It\'s the answer.', 'Kévin');
} catch(\SmsSender\Exception\WrappedException $e){
    if($e->getWrappedException() && $e->getWrappedException() instanceof \SmsSender\Exception\AdapterException){
        $smsException = new \Exception($e->getWrappedException()->getMessage(), $e->getWrappedException()->getCode(), $e);
        if($e->getWrappedException()->getData()){
            var_dump($e->getWrappedException()->getData()); // request data
        }

    }
    throw $smsException;
}

Recommended

It is recommended to use this bundle together with bundle of https://packagist.org/packages/avtonom/limit-number-calls-bundle. Defender for Symfony 2, of the large count of requests. It protects against multiple processing one value. Guard, aims to protect against brute force and dictionary attacks.

Need Help?

  1. Create an issue if you've found a bug,

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固