Download the PHP package compono-kit/types without Composer
On this page you can find all versions of the php package compono-kit/types. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download compono-kit/types
More information about compono-kit/types
Files in compono-kit/types
Package types
Short Description Basic type classes wrapping scalar values to create types in applications. Implementations of compono-kit/types-interfaces
License proprietary
Informations about the package types
ComponoKit / Types
Strongly typed value objects for PHP 8+
This package provides a lightweight foundation for building domain-driven, immutable, and type-safe value objects in PHP implementing compono-kit/types-interfaces.
Each type implements its own interfaces and can be used directly via traits or abstract classes.
It is designed for type safety, validation, and consistent methods for comparison, conversion, and manipulation.
100% code coverage without senseless LLM generated tests!
Requirements
- PHP 8+
- compono-kit/types-interfaces
🚀 Installation
Type Overview
| Type | Interface | Description |
|---|---|---|
| BooleanType | RepresentsBoolean |
Represents a boolean value with conversion and comparison methods |
| IntegerType | RepresentsInteger |
Represents an integer with mathematical and comparison operations |
| FloatType | RepresentsFloat |
Represents a float with mathematical and comparison operations |
| StringType | RepresentsString |
Represents a string with extensive methods for manipulation, comparison, and regex |
| DateType | RepresentsDate |
Represents a date/time with comparison, addition/subtraction, and formatting |
| Uuid4 | RepresentsString |
Represents a Uuid v4 value |
| Uuid7 | RepresentsString |
Represents a Uuid v7 value |
All types implement the base interface RepresentsType, which includes methods such as equals() and toNativeType().
Architecture
Each type can be used in three ways:
-
Trait – Implements all interface methods.
Advantage: You can use traits in your own classes without inheriting the abstract class. -
Abstract Class – Uses the trait and adds an abstract
isValid()method for validation.
Advantage: Easily extendable for specific type rules. - Default Implementation – Standard implementation without special validation.
Advantage: Quick usage for generic types.
Usage Examples
String
Integer
Float
Boolean
Date
UUID4
Exceptions
All types use their own exceptions derived from RepresentsTypeException.
Summary
- Traits: Full interface implementation, usable without abstract classes.
- Abstract Classes: Traits +
isValid()method for custom validation logic. - Default Types: Quick start without custom validation.
- UUID4: Special string type with generated UUID.
- Benefits: Type safety, consistent methods, easy extensibility and validation.
All versions of types with dependencies
ext-intl Version *
ext-json Version *
ext-ctype Version *
compono-kit/types-interfaces Version ^1.0.0