Declare interface bindings using attributes
Using composer
composer require ornikar/attribute-binding
<?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
{
//
}
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.