2017 © Pedro Peláez
 

library exwechat

image

youwen/exwechat

  • Friday, March 16, 2018
  • by youwen21
  • Repository
  • 5 Watchers
  • 12 Stars
  • 157 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

exwechat是一个微信公众号开发包

重要组成

  • Config 微信公众号配置管理
  • Cache 实现Psr\SimpleCache\CacheInterface PSR协议的缓存包
  • TokenManager 依赖Config和Cache, 从微信api获得access_token,缓存它。
  • ApiClient, 包装GuzzleHttp/Client
  • requests, 每一个request都对应微信公众号的API

TokenManager 和 ApiClient是最重要的两个类。
TokenManager 调度cache缓存access_token。 另外从微信公众号获得access_token。
ApiClient 包装GuzzleHttp/Client, xmlProcessor, jsonProcessor三个类。 一部分调用微信公众号接口,另一部分是处理response返回的xml和json内容为array数组。, (*1)

如何记录接口请求日志

guzzle http middleware 可以设置中间件,通过中间件记录日志
推荐:, (*2)

https://github.com/gmponos/guzzle-log-middleware, (*3)

https://github.com/namshi/cuzzle, (*4)

已集成的api接口列表

下列表写(否)的接口代码不是微信提供的api接口,而是微信请求我方服务器接口。需要我方根据自身业务进行开发。, (*5)

需自行开发功能列表

- 微信卡券
- 微信门店
- 微信小店
- 智能接口
- 微信设备功能
- 新版客服功能
- 对话能力(原导购助手)
- 微信“一物一码”
- 微信发票
- 微信非税缴费

DEMO1

$redis = RedisFactory::create();
$redisCache = new RedisCache($redis);
$config = [
    'app_id' => '',
    'secret' => '',
    'redirect_uri' => '',
];

$tokenManager = new TokenManager($config, $redisCache);
$token = $tokenManager->getAccessToken();
$api = new ApiClient();

$ipRequest = (new Ips)->getIps($token);
$response = $api->send($ipRequest);

DEMO2 使用facade

// facade
$redis = RedisFactory::create();
$redisCache = new RedisCache($redis);
$config = [
    'app_id' => '',
    'secret' => '',
    'redirect_uri' => '',
];

$tokenManager = new TokenManager($config, $redisCache);
$token = $tokenManager->getAccessToken();
$api = new ApiClient();

$facade = new WechatFacade($tokenManager, $api);

$ips = $facade->getIps();

The Versions

16/03 2018

dev-master

9999999-dev

  Sources   Download

by baiyouwen

23/02 2018

v1.1.0

1.1.0.0

  Sources   Download

by baiyouwen

01/10 2017

v1.0.3

1.0.3.0

  Sources   Download

by baiyouwen

24/03 2017

v1.0.2

1.0.2.0

  Sources   Download

by baiyouwen

06/03 2017

v1.0.1

1.0.1.0

  Sources   Download

by baiyouwen

06/03 2017

v1.0.0

1.0.0.0

  Sources   Download

by baiyouwen