icanboogie / bind-prototype
Binds icanboogie/prototype to ICanBoogie.
Installs: 2 854
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- icanboogie/icanboogie: ^5.0
- icanboogie/prototype: ^5.0
Requires (Dev)
- phpunit/phpunit: ^8.5
README
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.