承接 mildberry/notifier 相关项目开发

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

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

mildberry/notifier

Composer 安装命令:

composer require mildberry/notifier

包简介

Library for send user notifications by different transports

README 文档

README

Library for send user notifications by different transports

SensioLabsInsight Build Status codecov

Install

$ composer require mildberry/notifier

Usage

<?php

use Mildberry\Notifier\Interfaces\SmsNotifyInterface;
use Mildberry\Notifier\Notifier;
use Mildberry\Notifier\Notify\NotifyCollection;
use Mildberry\Notifier\Notify\SmsNotify;
use Mildberry\Notifier\Transport\VarDumpTransport;

include 'vendor/autoload.php';

$notifier = new Notifier();
$notifier->setNotifyTransport(SmsNotifyInterface::class, (new VarDumpTransport()));

$notifier->send(new SmsNotify('79136703311', 'Hello world'));

$collectionSms = new NotifyCollection();
$collectionSms
    ->push(new SmsNotify('79136703311', 'How a you?'))
    ->push(new SmsNotify('79136703311', 'Where are you?'));

$notifier->sendCollection($collectionSms);

Custom notify

<?php

use Mildberry\Notifier\Interfaces\SmsNotifyInterface;
use Mildberry\Notifier\Notifier;
use Mildberry\Notifier\Notify\Notify;
use Mildberry\Notifier\Transport\VarDumpTransport;

include 'vendor/autoload.php';

class ActivationSms extends Notify implements SmsNotifyInterface
{
    public function __construct($phone, $code)
    {
        $this
            ->setRecipient($phone)
            ->setBody('Your activation code is '.$code)
        ;
    }
}

class RegistrationCompleteSms extends Notify implements SmsNotifyInterface
{
    public function __construct($phone)
    {
        $this
            ->setRecipient($phone)
            ->setBody('Congratulations registration is completed')
        ;
    }
}

$notifier = new Notifier();
$notifier->setNotifyTransport(SmsNotifyInterface::class, (new VarDumpTransport()));

// ... registration process

$notifier->send(new ActivationSms('79136703311', rand(1, 9999)));

// ... registration complete

$notifier->send(new RegistrationCompleteSms('79136703311'));

TODO

  • Documentation for Transports
  • Documentation for Storage
  • Saving externalID and save delivery state from transport
  • Notify query

License

This library is under the MIT license. See the complete license in here

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固