javanile / granular
该包的最新版本(0.0.11)没有可用的许可证信息。
0.0.11
2020-04-24 07:46 UTC
Requires
- psr/container: ^1.0
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-09-24 17:06:22 UTC
README
基于面向对象范式的WordPress扩展框架。使用Granular,您可以编写PSR兼容的代码,提高代码质量,更好地组织项目。在相同的作用域中组织您的代码,或按功能或分组WordPress操作和过滤器。
namespace Acme\Plugin; use Javanile\Granular\Bindable; class MyFirstPluginFeature extends Bindable { static $bindings = [ 'action:init', 'filter:the_content' => 'theContent', ]; public function init() { // Init code } public function theContent($content) { return $content; } }
use Javanile\Granular\Autoload; $app = new Autoload(); // add MyPlugin::init() method to WordPress init action $app->register(MyPlugin::class, 'init');
测试
$ docker-compose run --rm phpunit --stop-on-failure tests