PHP Micro-Letter Sdk--zebra-wechat

Source: Internet
Author: User
Zebra-wechat

The SDK is currently in the development State and currently implements the following features:

  • Receive server push information to identify the type of push information
  • API Client Encapsulation (user management, user group management, customer service Management, custom menu management, System Management, etc.)
  • Jump Verify Encapsulation
  • Card Roll Support
  • Blog Address: www.huyanping.cn

    Receive push samples

    Use \jenner\zebra\wechat\wechatserver;use \jenner\zebra\wechat\response\textresponse, $token = ' you Wechat token '; $ Server = new Wechatserver ($token);//Call before processing event, whether or not there is a registered event handler $server->on (' Before ', function (Wechatserver $server, $ Request) {//do something}), or//after handling the event call, $result the return value of the event handler $server->on (' After ', function (Wechatserver $server, $ Result) {//do something});//Unknown Message Processor $server->on (' Unknown_message ', function (Wechatserver $server, $request) {//do something});//Unknown Time processor $server->on (' Unknown_event ', function (Wechatserver $server, $request) {//do something});//    Handle text message Push $server->on (' text ', function (Wechatserver $server, $request) {$to _user = $server->getfromusername ();    $from _user = $server->gettousername ();    $response = new Textresponse ($to _user, $from _user, ' hello '); $server->send ($response);}); /Handling Focus Push $server->on (' subscribe ', function (Wechatserver $server, $request) {$to _user = $server->getfromusername (    ); $from _user = $server->gettouserName ();    $response = new Textresponse ($to _user, $from _user, ' thx '); $server->send ($response);});

    To send messages proactively

    Define (' wechat_app_id ', ' Your APP ID ');d efine (' Wechat_secret ', ' your SECRET '); $to _user = ' to_user_open_id '; $text = ' Hello '; $text _message = new \jenner\zebra\wechat\client\message\textmessage ($to _user, $text); $text _message->send ();
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.