ornikar/attribute-binding

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

This package is not auto-updated.

Last update: 2024-09-26 10:28:37 UTC


README

使用属性声明接口绑定

安装

使用 composer

composer require ornikar/attribute-binding

使用方法

<?php

declare(strict_types=1);

namespace Acme;

use Ornikar\AttributeBinding\BindTo;

#[BindTo(MyImplementation::class)]
interface MyInterface
{
    //
}

声明单例绑定

<?php

declare(strict_types=1);

namespace Acme;

use Ornikar\AttributeBinding\BindingType;
use Ornikar\AttributeBinding\BindTo;

#[BindTo(MyImplementation::class, BindingType::Singleton)]
interface MyInterface
{
    //
}

贡献

欢迎提交拉取请求。对于重大更改,请先提交一个问题以讨论您想要更改的内容。

请确保根据需要更新测试。

许可证

MIT