suframe / sunny
sunny-ngrok for thinkphp
1.0.1
2019-12-28 06:34 UTC
This package is auto-updated.
Last update: 2024-09-29 05:35:52 UTC
README
开发交流QQ群:647344518 立即加群
在开发过程中,经常需要用到外网访问接口,比如公众号,小程序,或者你为客户开发网站系统,客户需要预览等。上传到服务器上调试总是比较麻烦,ngrok可以解决您的问题,让您本地开发的程序可以外网访问。
sunny是一个提供免费和付费内网穿透的工具,此库就是用于集成到thinkphp,让程序可外网访问。支持http, https, tcp转发。
可绑定自定义域名或者使用免费的3级域名。
注册账户:
注意开通隧道时,如果您想所有人都可以访问,不要设置http验证用户名和密码。
- 1. 登录http://www.ngrok.cc,注册账户
- 2. 按教程开通隧道:http://www.ngrok.cc/_book/general/open.html 选择香港Ngrok免费服务器,当然,有速度要求的可以选择付费,也不贵。
- 3. 如果是定义域名,请按教程解析http://www.ngrok.cc/_book/general/hostname.html
- 4. 复制隧道id
安装:
composer install suframe/sunny
修改config/sunny.php clientid => '上面创建的隧道id',
运行
运行前请先启动您的项目,确保本地可访问,否则转发无法接收数据。
php think sunny
# 或者运行原始脚本
php vendor/suframe/sunny/src/sunny.php
#后台运行
setsid php think sunny &
# 关闭后台进程
ps -ef | grep 'php think sunny' | grep -v grep | cut -c 9-15 | xargs kill -9
访问您隧道绑定的或赠送的域名即可。开始愉快的开发吧。