Rename namespace to Tezmanian and prepare for Packagist
PHP Composer / build (push) Successful in 36s
PHP Composer / build (push) Successful in 36s
- 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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
# tez-utils-validate
|
||||
|
||||
[](https://github.com/tezmanian/tez-utils-validate/actions/workflows/php.yml)
|
||||
[](https://packagist.org/packages/tezmanian/utils-validate)
|
||||
[](https://packagist.org/packages/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
|
||||
|
||||
+20
-3
@@ -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": {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Validate;
|
||||
namespace Tezmanian\Utils\Validate;
|
||||
|
||||
/**
|
||||
* Combines boolean predicates with AND / OR / NONE logic.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Validate;
|
||||
namespace Tezmanian\Utils\Validate;
|
||||
|
||||
final class Guard
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Validate;
|
||||
namespace Tezmanian\Utils\Validate;
|
||||
|
||||
/**
|
||||
* Stateless boolean predicates for common validation needs.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Validate;
|
||||
namespace Tezmanian\Utils\Validate;
|
||||
|
||||
/**
|
||||
* Validates an array against a shape definition.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Validate;
|
||||
namespace Tezmanian\Utils\Validate;
|
||||
|
||||
/**
|
||||
* Strict type coercion — throws UnexpectedValueException when a value
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
+3
-3
@@ -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
|
||||
{
|
||||
|
||||
+2
-2
@@ -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
|
||||
{
|
||||
|
||||
+2
-2
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user