承接 digitalstate/platform-transport-bundle 相关项目开发

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

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

digitalstate/platform-transport-bundle

Composer 安装命令:

composer require digitalstate/platform-transport-bundle

包简介

DigitalState Transport Bundle

README 文档

README

The Transport bundle provides the developers the foundation and common API for sending messages programmatically. It introduces two new entities to the system: Transport and Profile.

Code Climate Test Coverage

Table of Contents

Transport Entity

Transports are in charge of sending messages to recipients. For example, the developer could define a Transport that knows how to send messages via Twilio SMS.

Internally, each Transport is associated with a PHP class. To create a Transport class, the developer needs to implement the Transport Interface.

Example src/Gov/Bundle/DemoBundle/Transport/Sms/TwilioTransport.php:

<?php

namespace Gov\Bundle\DemoBundle\Transport\Sms;

use Ds\Bundle\TransportBundle\Transport\Transport;
use Ds\Bundle\TransportBundle\Model\Message;
use Ds\Bundle\TransportBundle\Entity\Profile;
use UnexpectedValueException;

class TwilioTransport implements Transport
{
    // ...
    
    public function send(Message $message, Profile $profile = null)
    {
        // Use Twilio SDK to send message.
        // ...
        $success = true;
        //

        if (!$success) {
            throw new UnexpectedValueException('Message could not be sent.');
        }

        return $this;
    }
}

A Transport class needs to be registered as a service in the Symfony Service Container and be tagged with the ds.transport tag.

Example src/Gov/Bundle/DemoBundle/Resources/config/services.yml:

services:
    gov.demo.transport.sms.twilio:
        class: Gov\Bundle\DemoBundle\Transport\Sms\TwilioTransport
        tags:
            - { name: ds.transport, implementation: sms.twilio }

The implementation attribute is a string value that identifies programmatically a Transport and should be unique.

Profile Entity

A Profile is associated to a Transport and defines the configurations needed by that Transport. Configurations such as hostname, username, password, api key, secret key, etc. For example, a business user could create a Profile via the administrative interface, associate it with the Twilio Transport and provide the needed configurations such as the Twilio api key and credentials.

It is possible to create multiple Profiles for a single Transport. The business user may eventually choose which Profile to use when sending a specific message. For example, Twilio provides different account credentials based on the different geographic areas you want to send messages from.

Todo

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固