jitesoft / wp-base
jitesoft WordPress 插件的内部基础包 - 并非插件本身。
1.1.0
2022-08-15 19:15 UTC
Requires
- php: >=7.4.2|>=8|>=8.1
- jitesoft/container: ^4.1.0|^5.0.0|^5.1.0
- psr/cache: ~1.0.0|^3.0.0
Requires (Dev)
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-09-16 00:03:03 UTC
README
这并非插件,也并非真正比 jitesoft WordPress 插件的核心部分多出多少功能。
这个库允许调用 jitesoft(...) 方法,它基本上包含一个静态容器,可以查询其中的对象。
如果 jitesoft 插件使用了基础包,它将对象注入到容器中,使其在任何地方都能轻松查询。
<?php jitesoft('logger')->debug(...);
根据插件类型,对象可以是单例类型(这意味着它不会被重新创建)或标准对象。
如果需要,您可以在其他插件中使用该对象,但不会提供对包的实际支持。
基本用法
// Add something Jitesoft\WordPress\Plugins\Base\getContainer()->bind('something', 'something'); // Get something Jitesoft\WordPress\Plugins\Base\getContainer()->get('something'); // 'something' // Get something via convenience method jitesoft('something'); // 'something'
有关底层容器的完整文档,请查看 jitesoft/container
许可证
MIT