Download the PHP package xinqudao/thinkphp5-easywechat4 without Composer

On this page you can find all versions of the php package xinqudao/thinkphp5-easywechat4. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package thinkphp5-easywechat4

介绍

微信SDK For ThinkPHP 5.0+ 基于overtrue/wechat easywechat SDK for ThinkPHP5.0 由于easywechat 4参考Laravel的框架风格,缺少集成ThinkPHP 5.0.*版本比较优雅的方式,还有很多基于ThinkPHP 5.0的系统有微信开发需求,因此开发此SDK供legacy system使用 增加小程序云开发、微信支付服务商等接口

软件架构

软件架构说明

  1. ThinkPHP 5.0.*没有container和facade,因此需增加相关依赖
  2. 使用了facade模式, TP5.0不支持, composer安装已自动复制, 如未生效, 需要手动将TP5.1的think\Facade.php文件拷贝到 thinkphp\library\think 目录下,facade.php无其他依赖
  3. 由于TP5.0不支持容器, TP5.1的容器有一定耦合度不利于升级, 因此采用了illuminate/container
  4. TP5.0不支持middleware,中间件暂无更优雅的替代方案, 可以使用Hook 机制将具体实现的业务逻辑分发到各个模块

安装

Composer安装

composer require uctoo/think-easywechat:dev-master

Git安装

https://github.com/uctoo/think-easywechathttps://gitee.com/UCT/think-easywechat

配置

  1. 修改配置文件 修改项目根目录下extra/wechat.php中对应的参数

  2. 每个模块基本都支持多账号,默认为 default。

  3. 如需应用启动时自动加载SDK,建议将Behavior\AppInit.php拷贝到application\common\behavior目录下,根据各自应用系统的情况初始化SDK

使用

接受普通消息

新建一个Controller,我这边用的是Official

获得SDK实例

使用facade

以上均支持传入自定义账号:例如

以上均支持传入自定义账号+配置(注:这里的config和配置文件中账号的格式相同):例如

微信第三方平台

新建一个Controller,微信第三方平台授权事件接收URL我这边用的是wechatopen\authevent

Oauth登录中间件(暂无解决方案)

HOOK

你可以监听相应的事件,并对事件发生后执行相应的操作。

开发说明

  1. 建议基于TP5.0和easywechat的项目采用uctoo/think-easywechat进行重构, 重构方式非常简单, 仅需替换获取easywechat SDK实例的代码即可, 理论上其他代码无需改动,以fastadmin官方微信管理插件为例 菜单管理功能 app\admin\controller\wechat\Menu

  2. 所有主动接口, 即通过应用服务器向微信服务器发送请求的, 都可以在业务实现点参考1 进行重构。所有被动响应接口, 即微信服务器向应用服务器推送消息的, 包括单独开发模式的 服务器地址(URL), 第三方开发模式的 授权事件接收URL和 消息与事件接收URL 都有中心化的入口, 建议采用easywechat的EventHandler机制 结合ThinkPHP的Hook机制, 分发到个业务实现点进行重构, 解耦各模块, 支持各模块实现微信开发的功能互不冲突, 可以商业化分发。以fastadmin官方微信管理插件为例

    微信接口 addons\wechat\controller\index

    在app\admin\eventhandler\wechat\CustomSendAutoReply类中具体实现功能

    这样可以将消息响应的中控服务器逻辑代码开源,需要实现业务的模块在开源代码中注册入口,在各自商业化模块中实现具体功能。

  3. 建议采用微信第三方平台方式进行微信相关功能开发,好处很多。

    更多 SDK 的具体使用请参考:https://easywechat.com

参考项目

交流群

QQ群:102324323(已满),138048128,使用疑问,开发,贡献代码请加群。

建议

近年微信生态已增加了很多新的能力,而且自2015年微信推出微信开放平台第三方开发方式以来,第三方开发方式逐渐流行,特别2017年小程序发布以来,第三方平台成为小程序的主要服务提供方式,建议采用第三方平台方式进行开发。

捐赠

如果觉得think-easywechat对你有帮助,欢迎请作者一杯咖啡

捐赠wechat

License

MIT


All versions of thinkphp5-easywechat4 with dependencies

PHP Build Version
Package Version
Requires overtrue/wechat Version ~4.0
topthink/framework Version dev-master
psr/simple-cache Version ^1.0
illuminate/container Version ^7.29
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package xinqudao/thinkphp5-easywechat4 contains the following files

Loading the files please wait ....