jardispsr/factory
最新稳定版本:1.0.0
Composer 安装命令:
composer require jardispsr/factory
包简介
This package provides a factory interfaces for a domain driven design approach
README 文档
README
This package provides factory interfaces for a domain-driven design (DDD) approach.
Installation
Install the package via Composer:
composer require jardispsr/factory
Requirements
- PHP >= 8.2
Usage
The package provides a FactoryInterface that defines a standard method for creating objects with support for versioning and dynamic parameters.
use JardisPsr\Factory\FactoryInterface; class MyFactory implements FactoryInterface { /** * @template T * @param class-string<T> $className * @param ?string $classVersion * @param mixed ...$parameters * @return T|mixed */ public function get(string $className, ?string $classVersion = null, ...$parameters): mixed { // Your factory implementation return new $className(...$parameters); } }
Parameters
$className: The fully qualified class name to instantiate$classVersion: Optional version string for versioned class creation...$parameters: Variadic parameters passed to the class constructor
Development
Code Quality
The project uses PHPStan for static analysis and PHP_CodeSniffer for code style checks:
# Run PHPStan vendor/bin/phpstan analyse # Run PHP_CodeSniffer vendor/bin/phpcs
Pre-commit Hook
A pre-commit hook is automatically installed via Composer's post-install script to ensure code quality before commits.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Issues: GitHub Issues
- Email: devcore@headgent.dev
Authors
- Jardis Core Development (jardisCore@headgent.dev)
Keywords
- factory
- interfaces
- JardisPsr
- Headgent
- DDD (Domain-Driven Design)
统计信息
- 总下载量: 84
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-27