Download the PHP package dodgepudding/wechat-php-sdk without Composer

On this page you can find all versions of the php package dodgepudding/wechat-php-sdk. 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 wechat-php-sdk

wechat-php-sdk

微信公众平台php开发包,细化各项接口操作,支持链式调用,欢迎Fork此项目
weixin developer SDK. 项目地址:https://github.com/dodgepudding/wechat-php-sdk
项目blog:http://binsee.github.io/wechat-php-sdk

使用详解

使用前需先打开微信帐号的开发模式,详细步骤请查看微信公众平台接口使用说明:
微信公众平台: http://mp.weixin.qq.com/wiki/ 微信企业平台: http://qydev.weixin.qq.com/wiki/

微信支付接入文档: https://mp.weixin.qq.com/cgi-bin/readtemplate?t=business/course2_tmpl&lang=zh_CN

微信多客服:http://dkf.qq.com

目录

wechat.class.php 官方API类库
qywechat.class.php 企业号API类库
errCode.php|qyerrCode.php 全局返回码类
old_version/wechatpay.class.php 旧版微信支付V2接口类库
old_version/wechatext.class.php 非官方扩展API(停止维护)
old_version/wechatauth.class.php 授权登陆(停止维护)
old_version/wechat.js 内嵌JS(已废弃)
为开发框架进行适配
调用示例


1. wechat.class.php 官方API类库

调用官方API,具有更灵活的消息分类响应方式,支持链式调用操作 ;

主要功能

初始化动作

被动接口方法:

预定义常量列表:

主动接口方法:

2. wechatext.class.php 非官方扩展API

此扩展类库已经不再更新,原因是官方对公众号开放了众多接口,此类库继续维护的意义不大
非官方扩展API,需要配置公众平台账户和密码,能实现对已关注用户的点对点微信,此方式不保证长期有效。
类方法里提及的用户id在接口返回结构里表述为FakeId, 属同一概念, 在下面wechatauth类里则表示为Uin, 用户id对应的微信号必须通过getInfo()方法通过返回数组的Username值获取, 但非关注关系用户资料不能获取.
调用下列方法前必须经过login()方法和checkValid()验证方法才能获得调用权限. 有的账户无法通过登陆可能因为要求提供验证码, 可以手动登陆后把获取到的cookie写进程序存放cookie的文件解决.
程序使用了经过修改的snoopy兼容式HTTP类方法, 在类似BAE/SAE云服务器上可能不能正常运行, 因为云服务的curl方法是经过重写的, 某些header参数如网站来源参数不被支持.

类主要方法:

3. wechatauth.class.php 授权登陆

此扩展类库已经不再更新,原因是官方开放平台对网站应用开放的有授权登陆接口,更标准,更好用。请查看:微信开放平台
通过微信二维码登陆微信的API, 能实现第三方网站同步登陆, 首先程序分别通过get_login_code和get_code_image方法获取授权二维码图片, 然后利用微信手机客户端扫描二维码图片后将自动跳出授权页面, 用户点击授权后即可获取对应的用户资料和头像信息. 详细验证步骤请看test3.php例子.

类主要方法:

4. wechat.js 内嵌JS

此JS脚本已经废弃不再更新,原因是官方在微信6.0.2版本开放了全新的JSAPI接口,更全面好用。请查看:微信公众平台WIKI

微信内嵌网页特殊功能js调用:

5. errCode.php 全局返回码类

当调用API接口失败时,可以用此类来获取失败原因的中文说明。
注意:微信公众号引用errCode.php,企业号引用qyerrCode.php

使用方法:

6. qywechat.class.php 企业号API类库

调用官方API,具有更灵活的消息分类响应方式,支持链式调用操作 ;

主要功能

初始化动作

被动接口方法:

预定义常量列表:

主动接口方法:

7. wechatpay.class.php 旧版微信支付V2接口类库

旧版微信支付类库(微信支付V2),已移动至old_version目录下。
自2014年8月开始申请到的微信支付都是V3接口,据官方说V2的会陆续升级为V3接口,但时间及升级渠道未确认。

主要功能

初始化动作

主动接口方法:

为开发框架进行适配

为不同的开发框架进行适配缓存操作(保存access_token、jsapi_ticket),及输出调试日志。

由于微信api需要缓存access_token与jsapi_ticket,而在不同框架下的缓存方式不同,所以原先在Wechat.class.php和QYWechat.class.php中缓存代码做了TODO标志。 需要各位在使用不同框架时再进行修改,但确实很麻烦,因为对结构进行了修改。

取消了原先同步维护的Thinkphp版本,为Wechat类增加操作缓存3个重载方法setCache, getCache, removeCache,以及修改log方法可以重载。 分别来实现在不同开发框架下的设置缓存、读取缓存、清除缓存、日志输出4个功能。

在不同的开发框架下使用Wechat类库,请继承Wechat类,根据需要实现这4个方法。
可参考Thinkphp版的TPWechat.class.php为不同框架进行适配。 欢迎提交其他框架的适配文件到项目库来。

为Thinkphp进行适配的示例如下:

调用示例


官方Wechat调用示例:

企业号API类库调用示例:

可参考test目录下的qydemo.php

扩展包Wechatext调用示例:

微信二维码Wechatauth登陆示例:

HTML部分请看old_version/test/test3.php, 主要是定时ajax查询是否已经授权成功

新版微信JSAPI调用DEMO:

请看test/jsapi目录

License

This is licensed under the GNU LGPL, version 2.1 or later.
For details, see: http://creativecommons.org/licenses/LGPL/2.1/


All versions of wechat-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.1.0
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 dodgepudding/wechat-php-sdk contains the following files

Loading the files please wait ....