You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.9 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <p align="center">
  2. <a href="https://easywechat.org/">
  3. <img src="https://easywechat.org/logo.svg" alt="EasyWeChat" width="160">
  4. </a>
  5. <p align="center">📦 It is probably the best SDK in the world for developing Wechat App.</p>
  6. <p align="center">
  7. <a href="https://travis-ci.org/overtrue/wechat"><img src="https://travis-ci.org/overtrue/wechat.svg?branch=master" alt="Build Status"></a>
  8. <a href="https://packagist.org/packages/overtrue/wechat"><img src="https://poser.pugx.org/overtrue/wechat/v/stable.svg" alt="Latest Stable Version"></a>
  9. <a href="https://packagist.org/packages/overtrue/wechat"><img src="https://poser.pugx.org/overtrue/wechat/v/unstable.svg" alt="Latest Unstable Version"></a>
  10. <a href="https://scrutinizer-ci.com/g/overtrue/wechat/build-status/master"><img src="https://scrutinizer-ci.com/g/overtrue/wechat/badges/build.png?b=master" alt="Build Status"></a>
  11. <a href="https://scrutinizer-ci.com/g/overtrue/wechat/?branch=master"><img src="https://scrutinizer-ci.com/g/overtrue/wechat/badges/quality-score.png?b=master" alt="Scrutinizer Code Quality"></a>
  12. <a href="https://scrutinizer-ci.com/g/overtrue/wechat/?branch=master"><img src="https://scrutinizer-ci.com/g/overtrue/wechat/badges/coverage.png?b=master" alt="Code Coverage"></a>
  13. <a href="https://packagist.org/packages/overtrue/wechat"><img src="https://poser.pugx.org/overtrue/wechat/downloads" alt="Total Downloads"></a>
  14. <a href="https://packagist.org/packages/overtrue/wechat"><img src="https://poser.pugx.org/overtrue/wechat/license" alt="License"></a>
  15. </p>
  16. </div>
  17. <p align="center">
  18. <b>Special thanks to the generous sponsorship by:</b>
  19. <br><br>
  20. <a href="https://www.yousails.com">
  21. <img src="https://yousails.com/banners/brand.png" width=350>
  22. </a>
  23. <br><br>
  24. <a href="https://laravist.com">
  25. <img width="160" src="https://o0dpls1ru.qnssl.com/laravist.com-logo.png">
  26. </a>
  27. </p>
  28. <p align="center">
  29. <img width="400" src="http://wx1.sinaimg.cn/mw690/82b94fb4gy1fgwafq32r0j20nw0nwter.jpg">
  30. </p>
  31. <p align="center">关注我的公众号我们一起聊聊代码怎么样?</p>
  32. ## Feature
  33. - 命名不那么乱七八糟;
  34. - 隐藏开发者不需要关注的细节;
  35. - 方法使用更优雅,不必再去研究那些奇怪的的方法名或者类名是做啥用的;
  36. - 自定义缓存方式;
  37. - 符合 [PSR](https://github.com/php-fig/fig-standards) 标准,你可以各种方便的与你的框架集成;
  38. - 高度抽象的消息类,免去各种拼json与xml的痛苦;
  39. - 详细 Debug 日志,一切交互都一目了然;
  40. ## Requirement
  41. 1. PHP >= 5.5.9
  42. 2. **[composer](https://getcomposer.org/)**
  43. 3. openssl 拓展
  44. 4. fileinfo 拓展(素材管理模块需要用到)
  45. > SDK 对所使用的框架并无特别要求
  46. ## Installation
  47. ```shell
  48. composer require "overtrue/wechat:~3.1" -vvv
  49. ```
  50. ## Usage
  51. 基本使用(以服务端为例):
  52. ```php
  53. <?php
  54. use EasyWeChat\Foundation\Application;
  55. $options = [
  56. 'debug' => true,
  57. 'app_id' => 'wx3cf0f39249eb0e60',
  58. 'secret' => 'f1c242f4f28f735d4687abb469072a29',
  59. 'token' => 'easywechat',
  60. 'log' => [
  61. 'level' => 'debug',
  62. 'file' => '/tmp/easywechat.log',
  63. ],
  64. // ...
  65. ];
  66. $app = new Application($options);
  67. $server = $app->server;
  68. $user = $app->user;
  69. $server->setMessageHandler(function($message) use ($user) {
  70. $fromUser = $user->get($message->FromUserName);
  71. return "{$fromUser->nickname} 您好!欢迎关注 overtrue!";
  72. });
  73. $server->serve()->send();
  74. ```
  75. 更多请参考[http://easywechat.org/](http://easywechat.org/)。
  76. ## Documentation
  77. - Homepage: http://easywechat.org
  78. - Forum: https://forum.easywechat.org
  79. - 微信公众平台文档: https://mp.weixin.qq.com/wiki
  80. - WeChat Official Documentation: http://admin.wechat.com/wiki
  81. > 强烈建议看懂微信文档后再来使用本 SDK。
  82. ## Integration
  83. [Laravel 5 拓展包: overtrue/laravel-wechat](https://github.com/overtrue/laravel-wechat)
  84. ## Contribution
  85. [Contribution Guide](.github/CONTRIBUTING.md)
  86. ## License
  87. MIT