someniatko/whitelist-container
Composer 安装命令:
composer require someniatko/whitelist-container
包简介
A PSR-11 container, wrapping existing container, but restricting access only to selected list of classes
README 文档
README
A PSR-11 container, wrapping existing container, but restricting access only to selected list of classes.
Installation
This library requires PHP 7.4 or 8.0. You can install it via Composer:
composer install someniatko/whitelist-container
Usage
<?php class Allowed {} class Prohibited {} use Someniatko\WhitelistContainer\WhitelistContainer; /** @var \Psr\Container\ContainerInterface $innerContainer */ $whitelistContainer = new WhitelistContainer( $innerContainer, [ Allowed::class ], 'my-container-name', // optional, used only for exception message ); $whitelistContainer->has(Allowed::class); // true $whitelistContainer->has(Prohibited::class); // false $whitelistContainer->get(Allowed::class); // Allowed instance $whitelistContainer->get(Prohibited::class); // @throws NotFoundExceptionInterface
统计信息
- 总下载量: 344
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-21