ornikar / attribute-binding
dev-main
2024-08-28 10:18 UTC
Requires
- php: ^8.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.63
- orchestra/testbench: ^9.2
- phpstan/phpstan: ^1.12
This package is not auto-updated.
Last update: 2025-07-03 14:20:10 UTC
README
Declare interface bindings using attributes
Installation
Using composer
composer require ornikar/attribute-binding
Usage
<?php declare(strict_types=1); namespace Acme; use Ornikar\AttributeBinding\BindTo; #[BindTo(MyImplementation::class)] interface MyInterface { // }
Declare binding as singleton:
<?php declare(strict_types=1); namespace Acme; use Ornikar\AttributeBinding\BindingType; use Ornikar\AttributeBinding\BindTo; #[BindTo(MyImplementation::class, BindingType::Singleton)] interface MyInterface { // }
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.