2017 © Pedro Peláez
 

library alibaba

阿里云 SDK

image

hachi-zzq/alibaba

阿里云 SDK

  • Sunday, July 29, 2018
  • by hachi-zzq
  • Repository
  • 1 Watchers
  • 1 Stars
  • 127 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

阿里云 SDK 工具包

author:zhuzhengqianhachi.zzq@gmail.com, (*1)

这个包是什么?

这个 SDK 包含阿里云部分云产品,目前已经集成的包括以下服务:, (*2)

  • 邮件推送
  • 语言合成(TTS)

如何安装

composer 引入

```$shell, (*3)

composer require hachi-zzq/alibaba, (*4)


## 开始使用 ### 配置文件 ```php <?php /** * 阿里云参数配置 */ return [ /** * access_key_id */ 'access_key_id' => 'access_key_id', /** * access_key_secret */ 'access_key_secret' => 'access_key_secret', 'response_type' => 'collection', /** * 邮件推送服务 */ 'direct_mail' => [ /** * 发信人,必须与阿里云后台配置的发信人一致 */ 'from' => '', /** * 发信人昵称 */ 'from_alias' => '', /** * 回信地址 */ 'reply_address' => false ] ];

使用示例

<?php

### 初始化应用
$application = new \Hachi\Alibaba\Application([
    /**
     * access_key_id
     */
    'access_key_id'     => 'access_key_id',

    /**
     * access_key_secret
     */
    'access_key_secret' => 'access_key_secret',
    'response_type'     => 'collection',

    /**
     * 邮件推送服务
     */
    'direct_mail'       => [

        /**
         * 发信人
         */
        'from'          => 'noreply@support.zhuzhengqian.com',

        /**
         * 发信人昵称
         */
        'from_alias'    => '',

        /**
         * 回信地址
         */
        'reply_address' => true
    ]
]);

### 调用邮件发送

#### 发送文本邮件

$textMessage = new \Hachi\Alibaba\DirectMail\TextMessage('这个是一个文本内容');

try {
    $body = $application->direct_mail->singleSend('hachi.zzq@gmail.com', $textMessage, '发送别名', '这个是主题');
} catch (\Hachi\Alibaba\Kernel\Exceptions\MailSendException $exception) {
    dd($exception);
}

#### 发送HTML邮件

$html = "


这个是段落, (*5)

"; $htmlMessage = new \Hachi\Alibaba\DirectMail\HtmlMessage($html); try { $body = $application->direct_mail->singleSend('hachi.zzq@gmail.com', $htmlMessage, '发送别名', '这个是主题'); } catch (\Hachi\Alibaba\Kernel\Exceptions\MailSendException $exception) { dd($exception); } dd($body); ### 调用语言合成 $outStream = $application->tts->speak('我是文本'); file_put_contents('/tmp/demo.mp3',$outStream);

The Versions

29/07 2018

dev-master

9999999-dev

阿里云 SDK

  Sources   Download

MIT

The Requires

 

by hachi

sdk aliyun alibaba 阿里云

19/07 2018

v1.0.4

1.0.4.0

阿里云 SDK

  Sources   Download

MIT

The Requires

 

by hachi

sdk aliyun alibaba 阿里云

14/07 2018

v1.0.3

1.0.3.0

阿里云 SDK

  Sources   Download

MIT

The Requires

 

by hachi

sdk aliyun alibaba 阿里云

14/07 2018

v1.0.2

1.0.2.0

阿里云 SDK

  Sources   Download

MIT

The Requires

 

by hachi

sdk aliyun alibaba 阿里云

13/07 2018

v1.0.1

1.0.1.0

阿里云 SDK

  Sources   Download

MIT

The Requires

 

by hachi

sdk aliyun alibaba 阿里云

12/07 2018

v1.0.0

1.0.0.0

阿里云 SDK

  Sources   Download

MIT

The Requires

 

by hachi

sdk aliyun alibaba 阿里云