定制 jardissupport/factory 二次开发

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

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

jardissupport/factory

最新稳定版本:v1.0.0

Composer 安装命令:

composer require jardissupport/factory

包简介

PSR-11 Container with pre-registered instances and reflection fallback

README 文档

README

Build Status License: MIT PHP Version PHPStan Level PSR-12 PSR-11

Part of the Jardis Business Platform — Enterprise-grade PHP components for Domain-Driven Design

PSR-11 Container with pre-registered instances and reflection fallback. Three source files, one dependency (psr/container), zero configuration overhead.

Features

  • PSR-11 ContainerInterface — standard get() and has() contract
  • Pre-registered Instances — pass objects at construction, retrieved by key
  • Backend Container Delegation — delegates to Symfony, Laravel, PHP-DI, or any PSR-11 container
  • Reflection Fallback — classes without required constructor params are instantiated automatically
  • Resolution Order — Instances → Backend → Reflection, each step optional
  • Immutable — all configuration via constructor, readonly after creation

Installation

composer require jardissupport/factory

Quick Start

use JardisSupport\Factory\Factory;

// Minimal — uses reflection for instantiation
$factory = new Factory();
$instance = $factory->get(MyService::class);

// With pre-registered instances
$factory = new Factory(instances: [
    LoggerInterface::class => $logger,
    CacheInterface::class => $cache,
]);

$factory->get(LoggerInterface::class);  // → $logger
$factory->get(SomeSimpleClass::class);  // → new instance via reflection

// With backend container
$factory = new Factory(container: $symfonyContainer, instances: [
    'override.service' => $myOverride,
]);

// Instances win over backend; backend wins over reflection

Resolution Order

get($id)
  ├── 1. Pre-registered instances (exact key match)
  ├── 2. Backend container ($container->has($id) ? $container->get($id))
  └── 3. Reflection (class_exists($id) ? new $id())

If none matches → NotFoundException. If class exists but has required constructor params → ContainerException.

Documentation

Full documentation, guides, and API reference:

docs.jardis.io/en/support/factory

License

This package is licensed under the MIT License.

Jardis · Documentation · Headgent

KI-gestützte Entwicklung

Dieses Package liefert einen Skill für Claude Code, Cursor, Continue und Aider mit. Installation im Konsumentenprojekt:

composer require --dev jardis/dev-skills

Mehr Details: https://docs.jardis.io/skills

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固