Download the PHP package leeprince/laravel-wechat without Composer

On this page you can find all versions of the php package leeprince/laravel-wechat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-wechat

基于 laravel 开发微信公众号 composer 扩展包(20200322–_20200325)

1. 开通微信公众号:订阅号

  1. 微信公众号开通个人订阅号,并查看相关开发文档,并了解消息管理中的被动回复用户信息

2. 实现对接微信公众号功能

1.对接代码

2.在 「微信公众号->开发->基本配置->服务器配置」 中配置信息,其中服务器地址(URL)要能被外网访问,第一次配置会传入 echostr 参数进行服务器地址的有效校验,之后微信服务器与业务服务器的交互不再包含此参数。可以正确提交即检验成功,之后启动该服务配置。后面可以在「管理->消息管理」中查看用户给公众号发的消息。

项目的服务器地址的路由地址为:/wechat/subscription

补充:基于内网开发的可以使用 ngrok 进行内网穿透。ngrok 会分配 http 和 https 的临时链接供你使用的。(mac使用:/Applications/ngrok http 80)其中 「Web Interface」的本地链接 http://127.0.0.1:4040 是 web 页面用于查看 ngrok 转发的信息

3. 构建微信公众号对接功能到 composer 扩展包中

1.在项目(我的本地项目路径是:xxx/www/composer/laravel-wechat 此处为了更好在下文说明)中执行 composer init。本地没有 composer 的自行去官网下载吧。

2.在 composer.json 文件中添加自动加载配置

3.执行 composer update 更新获取依赖的最新版本

4. laravel 项目集成本地基于微信公众号开发 composer 组件包

1.在已经下载好的 laravel 项目(我的本地路径是:xxx/www/laravel69)中配置 composer laravel-wechat 扩展的本地仓库的相对路径或者绝对路径

2.增加新的依赖包到当前项目的 ./vendor/ 中

5. 编写服务提供者,并注册到 laravel 的服务提供者中

这是将该 composer leeprince/laravel-wechat 扩展包集成到 laravel 的第一步 1.在 laravel-wechat 项目的 ./src 路径下 编写服务提供者 WeChatServiceProvider 并继承 laravel 的服务提供者。注意命名空间为:namespace LeePrince\WeChat; 该服务提供者用于加载自定义组件中的所有服务

2.在 laravel 项目的 ./config/app.php 中注册该 composer 扩展包的服务提供者

6. 【核心服务:路由】

1.在 ./src/Route/route.php 中编写路由

2.在服务提供者 WeChatServiceProvider boot() 方法中加载路由

7. 【核心服务:控制器】

1.在 ./src/Http/Controllers/WxSubscriptionController.php.php 中编写控制器。由于上一步已经加载了路由,所以编写的控制器可以立即生效。

8.【扩展服务:中间件】

测试通过后继续完善代码提取检测签名部分到中间件中作为请求过滤,这里是用的是路由中间件。需要在 WeChatServiceProvider 服务提供者中加载路由中间件到路由中。

9.【扩展服务:视图】

1.在 ./src/Resources/views/view.blade.php 中编写视图文件。

2.在 WeChatServiceProvider 服务提供者中加载视图文件并设置命名空间

3.在在组件的路由配置文件 ./src/Route/route.php 中注册路由

10.【扩展服务:配置文件】

1.在 ./src/Config/wechat.php 中编写配置文件

2.在 WeChatServiceProvider 服务提供者中加载配置文件

3.在路由中注册一个测试路由,在闭包函数中获取该配置文件

11.【扩展服务:外部允许修改配置文件】

1.在服务提供者 WeChatServiceProvider 中添加允许在 laravel 框架的 config 中修改组件的配置文件,而无需到组件的配置文件中修改的方法。

2.在 laravel 项目的根目录执行命令:php artisan vendor:publish --provider="LeePrince\WeChat\WeChatServiceProvider" 即可在 laravel 项目的 ./config/wechat.php 中看到该组件的所有配置信息,并允许修改生效。

12.【扩展服务:自定义 Artisan 命令用于创建控制器到组件中】

1.在 ./src/Console/MakeWechatComposerControllerCommand.php 中编写自定义 Artisan 命令

2.在 WeChatServiceProvider 中注册自定义 Artisan 命令

  1. 在 laravel 项目的根目录中执行:php artisan list 查看自定义的 Artisan 命令已生效,即可使用该命令创建控制器到组件的 ./src/Http/Controllers/ 中

13. 发布 composer 组件包到 github 作为 composer 的代码仓库

14. 在 packagist 中提交该组件的 github 项目地址作为 composer 组件包的包仓库

15. 在 laravel 项目中删除 composer 的本地仓库,并使用 composer 的远程仓库

  1. 在 laravel 项目根目录的 composer.json 文件中删除本地仓库的信息

2.删除在 laravel 项目 ./vendor/ 目录的 leeprince 扩展包

3.使用 composer 远程仓库增加新的依赖包到当前 laravel 项目的 ./vendor 目录中

16. 最后查看整个基于 laravel 开发微信公众号 composer 扩展包集成到 laravel 后,在微信公众号运行的效果

使用该基于 laravel 开发微信公众号 composer 扩展包的方法

  1. composer require leeprince/laravel-wechat
  2. 执行命令 php artisan vendor:publish --provider="LeePrince\WeChat\WeChatServiceProvider" 生成配置文件
  3. 在 laravel 项目的 ./config/app.php 中注册该 composer 扩展包的服务提供者

github 代码仓库地址

https://github.com/leeprince/laravel-wechat

packagist composer 包仓库: leeprince/laravel-wechat

https://packagist.org/packages/leeprince/laravel-wechat

完善 README.md 的编写


All versions of laravel-wechat with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package leeprince/laravel-wechat contains the following files

Loading the files please wait ....