icanboogie/bind-prototype

将icanboogie/prototype绑定到ICanBoogie。

5.0 2021-05-31 22:08 UTC

This package is auto-updated.

Last update: 2024-08-25 06:17:57 UTC


README

Release Build Status Code Quality Code Coverage Packagist

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许可下发布。