承接 jardispsr/factory 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jardispsr/factory

最新稳定版本:1.0.0

Composer 安装命令:

composer require jardispsr/factory

包简介

This package provides a factory interfaces for a domain driven design approach

README 文档

README

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

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

Authors

Keywords

  • factory
  • interfaces
  • JardisPsr
  • Headgent
  • DDD (Domain-Driven Design)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-27