Download the PHP package xwzgit/my-wechat without Composer

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

微信公众号开发实践

1、验证服务器消息

public function index(Request $request)
{
    $signature = $request->get('signature');
    $timestamp = $request->get('timestamp');
    $nonce = $request->get('nonce');

    $validate = new ValidateMsg();//初始化该验证类,调用验证方法即可

    if ($validate->validateToken($signature, $timestamp, $nonce, $token)) {
        return $request->get('echostr');
    } else {
        return '';
    }
}

2、消息处理

//初始化消息处理类:处理消息接收和解密操作(如果有密文)
$params = [
            'token' => config('wechatC.token'),
            'encodingAesKey' => config('wechatC.encodeKey'),
            'appid' => config('wechatC.appid'),
            'timestamp' => $request->input('timestamp',''),
            'nonce' => $request->input('nonce',''),
            'msgSignatur' => $request->input('msg_signature',''),
            'encryptType' => $request->input('encrypt_type',''),
        ];
$msgManage = new MessageManage($params);

//获取推送的原始消息体,如果是密文的话就是密文格式
$receipt = $msgManage->getSourceMessage() 

//获取明文消息,数组格式数据
$message = $msgManage->getMessage();

//格式化成文本消息格式'<Content><![CDATA[' . $data['content'] . ']]></Content>'
//$data内容根据实际消息类型而定
//文本['content']; link:[title,description,url];image:[media_id]
//vioce:[media_id]; video:[title,description,media_id]
//news: [[title,description,url,picurl]]
$content = $msgManage->textContent($data)

//格式化成微信服务器可识别的xml数据,如果推送的消息是加密的话,将返回加密密文格式
$response = $msg->convertResponseMessage($message, $MsgType, $contents)

3、加密解密

//使用openssl_encrypt()进行加密,因为php7.1废弃了mcrypt加密
//解密openssl_decrypt()解密
//具体参见PrpCrypt.php文件

All versions of my-wechat with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6.0 || ^7.0
guzzlehttp/guzzle Version ^6.2
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 xwzgit/my-wechat contains the following files

Loading the files please wait ....