icanboogie/bind-prototype

Binds icanboogie/prototype to ICanBoogie.

5.0 2021-05-31 22:08 UTC

This package is auto-updated.

Last update: 2024-10-25 06:36:48 UTC


README

Release Build Status Code Quality Code Coverage Packagist

The icanboogie/bind-prototype package binds icanboogie/prototype to ICanBoogie, using its Autoconfig feature. It provides a config synthesizer for prototype methods defined in hooks configuration fragments.

<?php

namespace ICanBoogie;

require 'vendor/autoload.php';

$app = boot();

$app->configs['prototype']; // obtain the "prototype" config.

Binding prototype methods using hooks config fragments

Using hooks configuration fragments, components may bind multiple prototype methods.

The following example demonstrates how an application may bind a url() method and a url property to instances of ActiveRecord:

<?php

// config/prototype.php

namespace App;

$hooks = Hooks::class . '::';

return [

    Article::class . '::url' => $hooks . '::url',
    Article::class . '::get_url' => $hooks . '::url'

];

Requirements

The package requires PHP 7.2 or later.

Installation

composer require icanboogie/bind-prototype

Documentation

The package is documented as part of the ICanBoogie framework documentation. You can generate the documentation for the package and its dependencies with the make doc command. The documentation is generated in the build/docs directory. ApiGen is required. The directory can later be cleaned with the make clean command.

Testing

Run make test-container to create and log into the test container, then run make test to run the test suite. Alternatively, run make test-coverage to run the test suite with test coverage. Open build/coverage/index.html to see the breakdown of the code coverage.

License

icanboogie/bind-prototype is released under the New BSD License.