# wechat.php **Repository Path**: zhi/wechat.php ## Basic Information - **Project Name**: wechat.php - **Description**: 使用 PHP 编写的简洁微信公众平台服务器框架,简化微信公众平台服务端开发! - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-10-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Wechat.php ================ Wechat.php is an effort to create an elegant utility to interact with Server of [Wechat Media Platform][WechatMP], in PHP. Wechat.php is designed to work well with modern PHP environment, including namespaces and composer. The API is strongly influenced by [a fluent package written in Node.js][wx], written in modern PHP syntax. We hope this collection of code could benefit anyone who works with an account of [Wechat Media Platform][WechatMP]. The design of the library strictly follows the design of the Wechat Web API and provides functions/classes to facilitate your development. -- **We do the painful things for you!** Installation ------------ Though 'Wehcat.php' is designed to work with composer, the library is not yet uploaded and is under construction. Please add repository to your `composer.json`: ```json "repositories": [ { "type": "vcs", "url": "https://git.oschina.net/zhi/wechat.php.git" } ] ``` Then add dependency: ```json "require": { "yfwz100/wechat": "dev-master" } ``` Example ------- ```php event->on('subscribe', function () { // use `echo` to output everything you want just like plain PHP. // wechat\Reply class will generate the necessary XML for you. echo wechat\Reply::text("Welcome subscribing~"); }); // click action is subsection of events. $router->event->click->match('clicked', function ($matches) { echo wechat\Reply::text("You've clicked 'clicked'!"); }); // Keyword reply. $router->text->match('hello', function ($matches) { echo wechat\Reply::text("Hello, world!"); }); ``` Author ------ Zhi - yfwz100@yeah.net License ------- MIT. [WechatMP]: http://mp.weixin.qq.com/ "The home page of WechatMP." [wx]: http://www.weixinjs.org "The wx module for Node.js ."