icanboogie / bind-prototype
Binds icanboogie/prototype to ICanBoogie.
Installs: 2 897
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 prototype
configuration fragments.
<?php namespace ICanBoogie; require 'vendor/autoload.php'; $app = boot(); $app->configs[Prototype\Config::class]; // obtain the "prototype" config.
Installation
composer require icanboogie/bind-prototype
Binding prototype methods using prototype
config fragments
Using prototype
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 Article
:
<?php // config/prototype.php namespace App; use ICanBoogie\Binding\Prototype\ConfigBuilder; return fn(ConfigBuilder $config) => $config ->bind(Article::class, 'url', [ Hooks::class, 'url' ]) ->bind(Article::class, 'get_url', [ Hooks::class, 'get_url' ]);
Continuous Integration
The project is continuously tested by GitHub actions.
Code of Conduct
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.
Contributing
See CONTRIBUTING for details.