jardispsr/classversion

This package provides classversion interfaces for a domain driven design approach

Installs: 57

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Language:Makefile

pkg:composer/jardispsr/classversion

1.0.0 2025-12-03 12:51 UTC

This package is auto-updated.

Last update: 2025-12-03 13:28:01 UTC


README

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

This package provides classversion interfaces for a domain driven design approach.

Installation

composer require jrs/class-version

Interfaces

ClassVersionInterface

The main interface for resolving versioned class instances.

interface ClassVersionInterface
{
    /**
     * @template T
     * @param class-string<T> $className
     * @param ?string $version
     * @return mixed|T
     */
    public function __invoke(string $className, ?string $version = null): mixed;
}

ClassVersionConfigInterface

Interface for managing version configuration.

interface ClassVersionConfigInterface
{
    /**
     * @param string|null $version
     * @return string|null
     */
    public function version(?string $version = null): ?string;
}

Usage

Implement these interfaces to create a versioning system for your domain classes, allowing you to manage different versions of class implementations in your DDD architecture.

License

MIT