xzncit/developer-tools

PHP Development Framework

0.5.4 2024-02-26 02:51 UTC

README

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f576562736974652d41334d616c6c2d696d706f7274616e742e737667 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d47504c332e302d677265656e2e737667 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f45646974696f6e2d76302e352e332d626c75652e737667

如果本PHP WeChat 开发包对您有所帮助,您可以点右上角 "Star" 支持一下 谢谢!

环境要求

  • PHP >= 7.2.5
  • Composer
  • Openssl PHP Extension
  • MBstring PHP Extension
  • FileInfo PHP Extension

安装

composer require "xzncit/developer-tools:^0.5.4"

基本使用

include "vendor/autoload.php";

use xzncit\Factory;

try {
    // wechat 
    $app = Factory::Wechat([
        "token"=>"omJNpZEhZ5VFbk1HeHj1ZxFECKkP48BP",
        "appid"=>"wxa02e77d8a507d608",
        "appsecret"=>"3396f50c1f55c2089f4316b6f7c9f71b"
    ]);
    
    // 创建自定义菜单
    $response = $app->menu->create([
        // ...
    ]);
    
    // 返回信息
    var_dump($response);
}catch (\Exception $ex){
    echo("error: ".$ex->getMessage());
}

try {
    // mini
    $app = Factory::MiniProgram([
        "appid"=>"wxa02e77d8a507d608",
        "appsecret"=>"3396f50c1f55c2089f4316b6f7c9f71b"
    ]);
    
    // 登录凭证校验
    $response = $app->oauth->code2Session("31f55c2089f4316b6");
    
    // 返回信息
    var_dump($response);
}catch (\Exception $ex){
    echo("error: ".$ex->getMessage());
}

文档

文档整理中...

bug反馈

如果您使用过程中发现BUG或者其他问题都欢迎大家提交Issue,或者发送邮件给我 158373108@qq.com,我们将及时修复并更新。