Skip to content

A package to create some base handler for wechat events faster!

License

Notifications You must be signed in to change notification settings

Hanson/wechat-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wechat-handler

A package to create some base handler for wechat events faster! 帮你更快地生成微信事件文件

依赖

laravel 5+ (lumen 请看 wechat)

EasyWechat 3+

安装

composer require hanson/wechat-handler

使用

config/app.php的provider尾部加上


    App\Providers\EventServiceProvider::class,
    
    App\Providers\RouteServiceProvider::class,
    # 加上
    Hanson\Wechat\Handler\WechatHandlerServiceProvider::class,

然后执行php artisan make:handler

接下来会生成若干文件

app\Handler目录,负责处理所有的微信事件

app\Http\Controllers\Wechat为微信的controller

config\wechat.php 微信的配置(自行选择是否使用)

文档

Handler

所有消息事件都位于app/Handlers中,事件Handler位于app/Handlers/EventHandlers

Service

所有的服务事件,直接在继承BaseController 的 Controller中 调用 $this->service即可

#example:
class MyController extends BaseController{

    public function index(){
        $user = $this->user;
        echo $user->get('openid')->nickname;
    }
}

About

A package to create some base handler for wechat events faster!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages