PHPackages                             dzentota/typedvalue - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dzentota/typedvalue

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dzentota/typedvalue
===================

A PHP 8.1+ typed values (value objects) helper library with modern enum support and comprehensive security features.

056PHP

Since Apr 7Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/dzentota/typedvalue)[ Packagist](https://packagist.org/packages/dzentota/typedvalue)[ RSS](/packages/dzentota-typedvalue/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

TypedValue
==========

[](#typedvalue)

A PHP 8.1+ library for creating robust typed value objects with built-in validation, composite values, native enum support, and **comprehensive security features** for handling sensitive data.

Features
--------

[](#features)

- 🎯 **Type-safe value objects** with automatic validation
- 🔒 **Immutable by design** - values cannot be changed after creation
- 🧩 **Composite values** - build complex objects from simpler typed values
- 📋 **Enum support** - create type-safe enumerations
- ✅ **Comprehensive validation** with detailed error reporting
- 🔄 **TryParse pattern** - safe parsing without exceptions
- 🛡️ **Security-first design** with sensitive data protection
- 📊 **Logging policies** - control how sensitive data appears in logs
- 🕐 **Read-once values** - perfect for highly sensitive data like passwords and CVV codes
- 🎭 **Multiple obfuscation strategies** - masking, hashing, tokenization, encryption
- 🧪 **100% test coverage** - reliable and battle-tested

Installation
------------

[](#installation)

```
composer require dzentota/typedvalue
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher

### Modern PHP Features

[](#modern-php-features)

This library takes full advantage of modern PHP features:

- **Native Enums**: `SecurityStrategy` and `SecurityContext` use PHP 8.1+ backed enums
- **Match Expressions**: Advanced pattern matching for security policies
- **Readonly Properties**: Immutable security policy objects
- **Constructor Property Promotion**: Cleaner, more concise code
- **Union Types**: Flexible parameter handling

Quick Start
-----------

[](#quick-start)

### Basic Typed Value

[](#basic-typed-value)

```
