krubio/perfect-container
最新稳定版本:v1.2.1
Composer 安装命令:
composer require krubio/perfect-container
包简介
BROKEN Critical string handling bugs. Use perfectapp/perfect-container-psr-11 instead.
README 文档
README
⚠️ SECURITY WARNING: BROKEN - DO NOT USE
This container has critical bugs and should not be used in production.
🚨 Critical Issues:
- String handling bug: All string values are treated as class names
- Fatal errors: Simple values cause class instantiation attempts
- Production risks: Unexpected fatal errors in production environments
✅ Recommended Replacement:
Migrate immediately to: perfectapp/perfect-container-psr-11
🔒 This repository is archived and no longer maintained.
PerfectContainer
Description
PerfectContainer is a lightweight, easy-to-use Dependency Injection Container designed for PHP applications. It facilitates the management of class dependencies, promoting a clean and decoupled codebase. PerfectContainer allows developers to bind interfaces to concrete implementations, making it easier to swap out dependencies without modifying the dependent classes.
Features
- Simple API: Easy to use API for binding and resolving dependencies.
- Singleton Binding: Bind classes as singletons to reuse the same instance across the application.
- Auto-Resolving: Automatically resolve dependencies through type-hinted constructor injection.
- PSR-11 Compliant: Adheres to the PSR-11 Container Interface standard.
Upcoming Changes in Version 2.0.0
In Version 2.0.0, we are introducing a method renaming for improved consistency:
- Method Renaming: The
bindmethod will be renamed toset. This change is aimed at providing clearer semantics and aligning with standard practices in dependency injection containers.
Deprecation Notice
Starting from Version 1.1.0, the bind method is deprecated, and we encourage you to start using set to align with the upcoming changes in Version 2.0.0.
- Deprecated: The
bindmethod is deprecated and will be removed in a future release (Version 2.0.0). Please update your usage tosetto ensure compatibility with future versions.
We encourage you to update your usage accordingly to ensure compatibility with the latest version of PerfectContainer.
Installation
Use Composer to install the PerfectContainer library.
composer require krubio/perfect-container
Usage
Here's a basic usage example of PerfectContainer:
require 'vendor/autoload.php'; use PerfectApp\Container\Container; $container = new Container(); // Binding and resolving dependencies $container->set('SomeInterface', 'SomeImplementation'); $instance = $container->get('SomeInterface');
Contributing
Contributions, issues, and feature requests are welcome!
License
This project is MIT licensed.
krubio/perfect-container 适用场景与选型建议
krubio/perfect-container 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 138 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 10 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「container」 「di container」 「dependency injection container」 「autowire」 「Attribute Routing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 krubio/perfect-container 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 krubio/perfect-container 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 krubio/perfect-container 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A fast and intuitive dependency injection container.
Dependency injection container for the Monolith framework.
The PSR-11 container bridges
Http Microframework for Hack
PHP Dependency Injection Container
统计信息
- 总下载量: 138
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-13