From 18e2a4bb027c712bf3c7966be21c8815bcc0fd8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Halberstadt?= Date: Tue, 13 Oct 2026 17:15:47 +0200 Subject: [PATCH] Rename namespace to Tezmanian and prepare for Packagist - Namespace Tez\Utils -> Tezmanian\Utils, package tez/* -> tezmanian/* - Add keywords, homepage, authors and support metadata - Drop VCS repositories (resolved via Packagist) - Remove stale composer.lock, set license holder --- LICENSE | 2 +- README.md | 38 +++++++++++++++++++++++++++----------- composer.json | 23 ++++++++++++++++++++--- src/Composite.php | 2 +- src/Each.php | 2 +- src/Guard.php | 2 +- src/Rules.php | 2 +- src/Schema.php | 2 +- src/TypeCast.php | 2 +- tests/CompositeTest.php | 6 +++--- tests/EachTest.php | 6 +++--- tests/GuardTest.php | 4 ++-- tests/RulesTest.php | 4 ++-- tests/SchemaTest.php | 6 +++--- tests/TypeCastTest.php | 4 ++-- 15 files changed, 69 insertions(+), 36 deletions(-) diff --git a/LICENSE b/LICENSE index ff3a818..f0a8205 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 Development +Copyright (c) 2026 René Halberstadt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including diff --git a/README.md b/README.md index 1bed02e..07fad47 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,20 @@ # tez-utils-validate +[![CI](https://github.com/tezmanian/tez-utils-validate/actions/workflows/php.yml/badge.svg)](https://github.com/tezmanian/tez-utils-validate/actions/workflows/php.yml) +[![Packagist Version](https://img.shields.io/packagist/v/tezmanian/utils-validate)](https://packagist.org/packages/tezmanian/utils-validate) +[![PHP](https://img.shields.io/packagist/php-v/tezmanian/utils-validate)](https://packagist.org/packages/tezmanian/utils-validate) +[![License: MIT](https://img.shields.io/packagist/l/tezmanian/utils-validate)](LICENSE) + PHP validation toolkit with guard assertions, composable rules, schema validation, strict type casting, and array-item validation. PHP 8.3+, no framework dependencies. ## Installation ```bash -composer require tez/utils-validate +composer require tezmanian/utils-validate ``` +Package: [`tezmanian/utils-validate`](https://packagist.org/packages/tezmanian/utils-validate) · Namespace: `Tezmanian\Utils\Validate` + ## Components | Class | Purpose | @@ -26,7 +33,7 @@ composer require tez/utils-validate Assertions that return the value on success, making them suitable for inline use. Throws `RuntimeException` by default; the exception can be overridden with a class name, an instance, or a closure. ```php -use Tez\Utils\Validate\Guard; +use Tezmanian\Utils\Validate\Guard; // Basic assertions $name = Guard::notNull($request->get('name')); @@ -60,7 +67,7 @@ Guard::notNull($value, fn() => new \DomainException('Value is required')); Stateless boolean predicates. Return `true`/`false` — never throw. ```php -use Tez\Utils\Validate\Rules; +use Tezmanian\Utils\Validate\Rules; Rules::isEmail('user@example.com'); // true Rules::isUrl('https://example.com'); // true @@ -90,8 +97,8 @@ Rules::isDate('23.04.2026', 'd.m.Y'); // true Combines multiple predicates into one using AND, OR, or NONE logic. Each method returns a `Closure` that can be passed directly to `Guard::that()`. ```php -use Tez\Utils\Validate\Composite; -use Tez\Utils\Validate\Rules; +use Tezmanian\Utils\Validate\Composite; +use Tezmanian\Utils\Validate\Rules; $isStrongPassword = Composite::all( fn($v) => Rules::minLength($v, 8), @@ -125,8 +132,8 @@ Validates an array against a shape definition. Fails fast on the first violation Prefix with `?` to mark a field as optional (absent or `null` is accepted). ```php -use Tez\Utils\Validate\Schema; -use Tez\Utils\Validate\Guard; +use Tezmanian\Utils\Validate\Schema; +use Tezmanian\Utils\Validate\Guard; Schema::validate($data, [ 'name' => 'string', @@ -155,7 +162,7 @@ user.profile.displayName: required field missing Strict type coercion — throws `UnexpectedValueException` when a value cannot be unambiguously converted, unlike PHP built-ins that silently truncate or guess. ```php -use Tez\Utils\Validate\TypeCast; +use Tezmanian\Utils\Validate\TypeCast; TypeCast::toInt('42'); // 42 TypeCast::toInt(3.0); // 3 @@ -184,8 +191,8 @@ TypeCast::toNullableBool(null); // null Applies a validation rule to every item in an array. Fails fast on the first violation and prepends the index path to the exception message. ```php -use Tez\Utils\Validate\Each; -use Tez\Utils\Validate\Guard; +use Tezmanian\Utils\Validate\Each; +use Tezmanian\Utils\Validate\Guard; $orders = [ ['amount' => 50], @@ -213,6 +220,15 @@ The original exception type is preserved, and the original exception is availabl - PHP 8.3+ - No runtime dependencies +## Development + +```bash +make build && make install +make ci # audit, PHPStan, code style, tests +``` + ## License -MIT +MIT — see [LICENSE](LICENSE). + +Author: René Halberstadt diff --git a/composer.json b/composer.json index a0d7d5b..45d8e64 100644 --- a/composer.json +++ b/composer.json @@ -1,16 +1,33 @@ { - "name": "tez/utils-validate", + "name": "tezmanian/utils-validate", "type": "library", "description": "Lightweight PHP validation toolkit: guard assertions, boolean rules, schema validation, strict type casting, composite predicates, and array-item validation — PHP 8.3+, no dependencies.", + "keywords": [ + "validation", + "guard", + "schema", + "php" + ], + "homepage": "https://github.com/tezmanian/tez-utils-validate", "license": "MIT", + "authors": [ + { + "name": "René Halberstadt", + "email": "tezmanian@gmail.com" + } + ], + "support": { + "issues": "https://github.com/tezmanian/tez-utils-validate/issues", + "source": "https://github.com/tezmanian/tez-utils-validate" + }, "autoload": { "psr-4": { - "Tez\\Utils\\Validate\\": "src/" + "Tezmanian\\Utils\\Validate\\": "src/" } }, "autoload-dev": { "psr-4": { - "Tez\\Utils\\Tests\\Validate\\": "tests/" + "Tezmanian\\Utils\\Tests\\Validate\\": "tests/" } }, "require": { diff --git a/src/Composite.php b/src/Composite.php index 22011d5..4188a3a 100644 --- a/src/Composite.php +++ b/src/Composite.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tez\Utils\Validate; +namespace Tezmanian\Utils\Validate; /** * Combines boolean predicates with AND / OR / NONE logic. diff --git a/src/Each.php b/src/Each.php index 1e53d72..b922bb3 100644 --- a/src/Each.php +++ b/src/Each.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tez\Utils\Validate; +namespace Tezmanian\Utils\Validate; /** * Applies a validation callable to every item in an array. diff --git a/src/Guard.php b/src/Guard.php index 47ada67..51a89a0 100644 --- a/src/Guard.php +++ b/src/Guard.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tez\Utils\Validate; +namespace Tezmanian\Utils\Validate; final class Guard { diff --git a/src/Rules.php b/src/Rules.php index 61129ff..96495c8 100644 --- a/src/Rules.php +++ b/src/Rules.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tez\Utils\Validate; +namespace Tezmanian\Utils\Validate; /** * Stateless boolean predicates for common validation needs. diff --git a/src/Schema.php b/src/Schema.php index 716d2e4..a155cce 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tez\Utils\Validate; +namespace Tezmanian\Utils\Validate; /** * Validates an array against a shape definition. diff --git a/src/TypeCast.php b/src/TypeCast.php index 0b817c8..7452024 100644 --- a/src/TypeCast.php +++ b/src/TypeCast.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tez\Utils\Validate; +namespace Tezmanian\Utils\Validate; /** * Strict type coercion — throws UnexpectedValueException when a value diff --git a/tests/CompositeTest.php b/tests/CompositeTest.php index d70d510..137f316 100644 --- a/tests/CompositeTest.php +++ b/tests/CompositeTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Tez\Utils\Tests\Validate; +namespace Tezmanian\Utils\Tests\Validate; use PHPUnit\Framework\TestCase; -use Tez\Utils\Validate\Composite; -use Tez\Utils\Validate\Rules; +use Tezmanian\Utils\Validate\Composite; +use Tezmanian\Utils\Validate\Rules; final class CompositeTest extends TestCase { diff --git a/tests/EachTest.php b/tests/EachTest.php index 5eb9542..3e929fe 100644 --- a/tests/EachTest.php +++ b/tests/EachTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Tez\Utils\Tests\Validate; +namespace Tezmanian\Utils\Tests\Validate; use PHPUnit\Framework\TestCase; -use Tez\Utils\Validate\Each; -use Tez\Utils\Validate\Guard; +use Tezmanian\Utils\Validate\Each; +use Tezmanian\Utils\Validate\Guard; final class EachTest extends TestCase { diff --git a/tests/GuardTest.php b/tests/GuardTest.php index 5b28239..e1b3178 100644 --- a/tests/GuardTest.php +++ b/tests/GuardTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tez\Utils\Tests\Validate; +namespace Tezmanian\Utils\Tests\Validate; use PHPUnit\Framework\TestCase; -use Tez\Utils\Validate\Guard; +use Tezmanian\Utils\Validate\Guard; final class GuardTest extends TestCase { diff --git a/tests/RulesTest.php b/tests/RulesTest.php index b7c74ca..0ed674a 100644 --- a/tests/RulesTest.php +++ b/tests/RulesTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tez\Utils\Tests\Validate; +namespace Tezmanian\Utils\Tests\Validate; use PHPUnit\Framework\TestCase; -use Tez\Utils\Validate\Rules; +use Tezmanian\Utils\Validate\Rules; final class RulesTest extends TestCase { diff --git a/tests/SchemaTest.php b/tests/SchemaTest.php index 9f804b3..af5d28b 100644 --- a/tests/SchemaTest.php +++ b/tests/SchemaTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Tez\Utils\Tests\Validate; +namespace Tezmanian\Utils\Tests\Validate; use PHPUnit\Framework\TestCase; -use Tez\Utils\Validate\Guard; -use Tez\Utils\Validate\Schema; +use Tezmanian\Utils\Validate\Guard; +use Tezmanian\Utils\Validate\Schema; final class SchemaTest extends TestCase { diff --git a/tests/TypeCastTest.php b/tests/TypeCastTest.php index ee8a0b6..19e0ad6 100644 --- a/tests/TypeCastTest.php +++ b/tests/TypeCastTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tez\Utils\Tests\Validate; +namespace Tezmanian\Utils\Tests\Validate; use PHPUnit\Framework\TestCase; -use Tez\Utils\Validate\TypeCast; +use Tezmanian\Utils\Validate\TypeCast; final class TypeCastTest extends TestCase {