Download the PHP package widuu/think-addons without Composer
On this page you can find all versions of the php package widuu/think-addons. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package think-addons
think-addons
tp6 (Thinkphp) 插件扩展包,更友好兼容
Thinkphp原生框架。插件路由分发器
think\addons\dispatch\Controller继承think\route\Dispatch插件支持
event/middleware/provider配置,没有将事件封装成hook函数,使用原生\think\facade\Event操作,让开发者能够快速上手,如果你习惯使用hook函数,只需要将下边的方法添加到app\common.php中即可更细化的配置,能够根据配置来进行按需加载
安装
全局配置
config\addons.php文件当运行到某个插件时譬如
test插件,会自动加载插件下的 (公共函数)common.php(服务注册)provider.php(事件)event.php和Test.php中的事件。但是
provider.php/event.php/Test.php文件中的事件和服务并不全局调用,假如你想在任何地方调用,可以开启上方的自动加载或者将这些配置到对应的配置数组中注:生产环境中(非
Debug)模式,会在缓存读取,所以有新的插件记住清除缓存,缓存名称在配置中自定义的。
生成插件
使用如下命令行可以自动生成插件
目录如下
我们插件实现类中可以通过注释修改事件名称,以
Test.php插件为类
插件公共方法
addons_url中的$url在插件内可以controller/action或者action,如果全局使用,addon/controller/action其它使用方法请参考 thinkphp 手册即可