定制 quillphp/container 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

quillphp/container

最新稳定版本:v0.0.1

Composer 安装命令:

composer require quillphp/container

包简介

First-class DI container with autowiring for Quill PHP

README 文档

README

First-class Dependency Injection container with zero-config autowiring for the Quill PHP Framework.

This container implements PSR-11 and provides a fast, reflection-based autowiring mechanism that eliminates the need for manual service configuration in most cases.

Installation

composer require quillphp/container

Features

  • PSR-11 Compliant: Seamless integration with any PSR-11 compatible library.
  • Recursive Autowiring: Automatically resolves and injects constructor dependencies.
  • Singletons: High-performance instance caching for shared services.
  • Interface Decoupling: Bind abstract interfaces to concrete implementations.
  • Circular Detection: Fail fast with clear error messages when circular dependencies occur.

Usage

Basic Autowiring

Simply request a class, and the container will instantiate it and all its dependencies:

use Quill\Container\Container;

class Mailer {}
class UserController {
    public function __construct(private Mailer $mailer) {}
}

$container = new Container();
$controller = $container->get(UserController::class); // Works out-of-the-box!

Manual Bindings

Singletons

Register a service that should only be instantiated once:

$container->singleton(Database::class, function($c) {
    return new Database(getenv('DB_URL'));
});

Interface Implementation

Tell the container which concrete class to use for an interface:

$container->bind(UserRepositoryInterface::class, SqliteUserRepository::class);

Integration with Quill App

Quill automatically uses this container for resolving handlers:

$app = new \Quill\App();
$app->singleton(MyService::class);

$app->get('/users', function(MyService $service) {
    // service is already resolved and injected!
});

License

This package is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固