sikessem/capsule
最新稳定版本:v0.5.2
Composer 安装命令:
composer require sikessem/capsule
包简介
Capsule is designed to make it easier to manage dependencies and objects, while improving encapsulation and ensuring code quality.
关键字:
README 文档
README
An Efficient Dependency Injector and Encapsulator
Capsule is a library that uses a Container to manage dependencies and objects in an organized and centralized way, thus facilitating encapsulation.
Warning
This package is no longer maintained. Please use sikessem/core instead.
🔖 Contents
📋 Requirements
- Requires PHP 8.1+ (at least 8.1.14 recommended to avoid potential bugs).
- Requires Composer v2+ to manage PHP dependencies.
⚡️ Installation
Install Capsule using Composer:
-
By adding the
sikessem/capsuledependency to yourcomposer.jsonfile:{ "require" : { "sikessem/capsule": "^0.5" } } -
Or by including the dependency:
composer require sikessem/capsule --no-dev
🧑💻 Usage
-
Define your custom components using Capsule's interfaces and traits:
<?php namespace Sikessem\Capsule\Sample; use Sikessem\Capsule\Core\IsEncapsulated; interface CustomInterface extends IsEncapsulated { public function getName(): string; public function setName(string $name): void; }
<?php namespace Sikessem\Capsule\Sample; final class CustomClass implements CustomInterface { use CustomTrait; public function __construct(string $name = 'World') { $this->setName($name); } }
<?php namespace Sikessem\Capsule\Sample; use Sikessem\Capsule\Core\HasEncapsulator; trait CustomTrait { use HasEncapsulator; protected string $name; public function getName(): string { return $this->name; } public function setName(string $name): void { $this->name = $name; } }
-
You can use your components as below:
<?php use Sikessem\Capsule\Sample\CustomClass; $capsule = new CustomClass('Sikessem'); isset($capsule->name); // Returns true echo $capsule->name; // Prints "Sikessem" unset($capsule->name); // Does nothing isset($capsule->name); // Returns true $capsule->value = 'value'; // Throws an exception $capsule->name = 'value'; // Set name to "value" echo $capsule->name; // Prints "value" $capsule->on('hello', function (?string $name = null) { return 'Hello '.($name ?? 'Sikessem').'!'; }); echo $capsule->hello(); //Prints "Hello Sikessem!"
👏 Contribution
The main purpose of this repository is to continue evolving Sikessem. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving Sikessem.
Code of Conduct
Sikessem has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
👥 Contributing Guide
Read our Contributing Guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Sikessem.
🔒️ Good First Issues
We have a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.
💬 Discussions
Larger discussions and proposals are discussed in sikessem/community.
🔐 Security Reports
If you discover a security vulnerability within Sikessem, please email SIGUI Kessé Emmanuel at contact@sigui.ci. All security vulnerabilities will be promptly addressed.
Made with ❤︎ by Sikessem.sikessem/capsule 适用场景与选型建议
sikessem/capsule 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.85k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 08 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「container」 「php」 「event」 「di」 「dic」 「ioc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sikessem/capsule 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sikessem/capsule 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sikessem/capsule 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A fast and intuitive dependency injection container.
Symfony bundle for broadway/broadway.
This is an Event Emitter equivalent to Node.js' Event Emitter.
Publish / Subscribe / Event Manager
Dependency injection container for the Monolith framework.
The PSR-11 container bridges
统计信息
- 总下载量: 1.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 40
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-15