Skip to content

alinew/wechat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Work WeChat

企业微信 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);

About

企业微信 API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages