ornikar/attribute-binding

dev-main 2024-08-28 10:18 UTC

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.

License

MIT