sikessem/capsule 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

sikessem-logo


php-icon packagist-version-icon packagist-download-icon license-icon actions-icon pr-icon twitter-icon

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/capsule dependency to your composer.json file:

    {
        "require" : {
            "sikessem/capsule": "^0.5"
        }
    }
  • Or by including the dependency:

    composer require sikessem/capsule --no-dev

🧑‍💻 Usage

  1. 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;
        }
    }
  2. 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 sikessem/capsule 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.85k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 40
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-15