Skip to content

Commit

Permalink
Add:add wechat 1.2.x docs
Browse files Browse the repository at this point in the history
  • Loading branch information
XueSiLf committed May 30, 2021
1 parent 66cee0a commit e3d5e26
Show file tree
Hide file tree
Showing 4 changed files with 3,866 additions and 23 deletions.
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,45 @@
[![License](https://poser.pugx.org/easyswoole/wechat/license)](https://packagist.org/packages/easyswoole/wechat)
[![Monthly Downloads](https://poser.pugx.org/easyswoole/wechat/d/monthly)](https://packagist.org/packages/easyswoole/wechat)

EasySwoole WeChat 是一个基于 Swoole 4.x 全协程支持的微信SDK库,告别同步阻塞,轻松编写高性能的微信公众号/小程序/开放平台业务接口
`EasySwoole WeChat 1.2.x` 是一个基于 `Swoole 4.x` 全协程支持的微信 `SDK` 库,告别同步阻塞,轻松编写高性能的微信公众号/小程序/开放平台业务接口

## 文档说明

- [组件安装](docs/install.md)
- [公众号组件文档](docs/officialAccount.md)
- [小程序组件文档](docs/miniProgram.md)

## 获取实例

在开始操作之前需要获取一个实例,后续操作均使用该实例进行操作
在开始操作之前需要先获取一个实例,后续操作均使用该实例进行操作

```php

use EasySwoole\WeChat\WeChat;
use EasySwoole\WeChat\Config;

$wechat = new WeChat(); // 创建一个实例
$wechat->config()->setTempDir(EASYSWOOLE_TEMP_DIR); // 指定全局临时目录
<?php
use EasySwoole\WeChat\WeChat;
use EasySwoole\WeChat\Config;

$wechat = new WeChat(); // 创建一个实例
$wechat->config()->setTempDir(EASYSWOOLE_TEMP_DIR); // 指定全局临时目录
```

## 异常捕获

在调用方法时,如果传递了无效的参数或者发生网络异常,将会抛出 ***EasySwoole\WeChat\Exception\RequestError*** 或者 ***EasySwoole\WeChat\Exception\OfficialAccountError*** 类型的异常,开发者需要手工捕获该类异常进行处理,类似这样
在调用方法时,如果传递了无效的参数或者发生网络异常,将会抛出 ***\EasySwoole\WeChat\Exception\RequestError*** 或者 ***\EasySwoole\WeChat\Exception\OfficialAccountError*** 类型的异常,开发者需要手动捕获该类异常进行处理,类似如下这样

```php

use EasySwoole\WeChat\Exception\RequestError;
use EasySwoole\WeChat\Exception\OfficialAccountError;

try {
$wechat->officialAccount()->ipList();
} catch (RequestError $requestError){

} catch (OfficialAccountError $error){

}

<?php
use EasySwoole\WeChat\Exception\RequestError;
use EasySwoole\WeChat\Exception\OfficialAccountError;

try {
$wechat->officialAccount()->ipList();
} catch (RequestError $requestError){

} catch (OfficialAccountError $error){

}
```


## 微信公众号

微信公众号沙箱: https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
微信公众号沙箱: [https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login](https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login)
31 changes: 31 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: easyswoole微信SDK
meta:
- name: description
content: easyswoole微信SDK
- name: keywords
content: easyswoole微信SDK|swoole微信SDK
---


# 微信 SDK EasySwoole WeChat 1.2.x

`EasySwoole WeChat` 是一个基于 `Swoole 4.x 全协程` 支持的微信 `SDK` 库,告别同步阻塞,轻松编写高性能的微信公众号/小程序/开放平台业务接口。

## 组件要求

- php >= 7.1.0
- easyswoole/component >= 1.0
- easyswoole/spl >= 1.3.7
- easyswoole/http-client ^1.0
- easyswoole/utility" ^1.0

## 安装方法

> ```
> composer require easyswoole/wechat=1.2.x
> ```
## 仓库地址
[easyswoole/wechat=1.2.x](https://github.com/easy-swoole/wechat)
Loading

0 comments on commit e3d5e26

Please sign in to comment.