薇娜/微信

微信SDK

维护者

详细信息

github.com/vzina/wechat

源代码

安装: 17

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

Forks: 2,402

1.0.0 2018-12-01 12:07 UTC

This package is auto-updated.

Last update: 2024-09-29 05:28:05 UTC


README

EasyWeChat Logo

要求

  1. PHP >= 5.6
  2. Composer
  3. openssl 扩展
  4. fileinfo 扩展(素材管理模块需要用到)

安装

$ composer require "vzina/wechat:~1.0" -vvv

使用

基本使用(以服务端为例)

<?php

use EasyWeChat\Factory;

$options = [
    'app_id'    => 'wx3cf0f39249eb0exxx',
    'secret'    => 'f1c242f4f28f735d4687abb469072xxx',
    'token'     => 'easywechat',
    'log' => [
        'level' => 'debug',
        'file'  => '/tmp/easywechat.log',
    ],
    // ...
];

$app = Factory::officialAccount($options);

$server = $app->server;
$user = $app->user;

$server->push(function($message) use ($user) {
    $fromUser = $user->get($message['FromUserName']);

    return "{$fromUser->nickname} 您好!欢迎关注 overtrue!";
});

$server->serve()->send();

更多信息请参考 https://www.easywechat.com/

文档

官网 · 教程 · 讨论 · 微信公众平台 · 微信官方

许可证

MIT