企业微信 API
企业微信提供了通讯录同步、应用管理、消息推送、OAuth2用户身份识别、JS-SDK等API,为企业接入更多个性化的办公应用。
- PHP >= 5.5.0
使用 composer:
composer require pithyone/wechat
本 SDK 不提供缓存方法,你必须自己定义缓存类,通过实现接口:pithyone\wechat\CacheInterface
本 SDK 不提供记录日志方法,你必须自己定义日志类,通过实现接口:Psr\Log\LoggerInterface
$config = [
// 是否写入日志
'debug' => true,
// 企业唯一corpid
'corp_id' => 'your_corp_id',
// 企业每一个应用都有一个独立的secret
'secret' => 'your_agent_secret',
// 可任意填写,用于生成签名
'token' => 'your_token',
// 用于消息体的加密,是AES密钥的Base64编码
'aes_key' => 'your_aes_key',
// 缓存类
'cache' => $your_cache_class,
// 日志类
'logger' => $your_log_class,
// Guzzle配置,参考: https://docs.guzzlephp.org/en/latest/request-options.html
'guzzle' => [
'timeout' => 5.0
]
];
$work = new \pithyone\wechat\Work($config);