icanboogie / bind-prototype
将icanboogie/prototype绑定到ICanBoogie。
5.0
2021-05-31 22:08 UTC
Requires
- php: >=7.2
- icanboogie/icanboogie: ^5.0
- icanboogie/prototype: ^5.0
Requires (Dev)
- phpunit/phpunit: ^8.5
README
icanboogie/bind-prototype包将icanboogie/prototype绑定到ICanBoogie,使用其Autoconfig功能。它为在hooks
配置片段中定义的原型方法提供配置合成器。
<?php namespace ICanBoogie; require 'vendor/autoload.php'; $app = boot(); $app->configs['prototype']; // obtain the "prototype" config.
使用hooks
配置片段绑定原型方法
使用hooks
配置片段,组件可以绑定多个原型方法。
以下示例演示了如何将url()
方法和url
属性绑定到ActiveRecord
的实例。
<?php // config/prototype.php namespace App; $hooks = Hooks::class . '::'; return [ Article::class . '::url' => $hooks . '::url', Article::class . '::get_url' => $hooks . '::url' ];
要求
该包需要PHP 7.2或更高版本。
安装
composer require icanboogie/bind-prototype
文档
该包作为ICanBoogie框架的一部分进行文档记录文档。您可以使用make doc
命令生成包及其依赖项的文档。文档生成在build/docs
目录中。ApiGen是必需的。稍后可以使用make clean
命令清理该目录。
测试
运行make test-container
以创建并登录到测试容器,然后运行make test
以运行测试套件。或者,运行make test-coverage
以带有测试覆盖率的运行测试套件。打开build/coverage/index.html
以查看代码覆盖率的细分。
许可
icanboogie/bind-prototype在新BSD许可下发布。