Rename namespace to Tezmanian and prepare for Packagist
PHP Composer / build (push) Successful in 33s

- 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:
2026-10-13 17:15:47 +02:00
parent 5af79e7459
commit 560e25a8db
16 changed files with 64 additions and 4596 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License 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 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 associated documentation files (the "Software"), to deal in the Software without restriction, including
+24 -8
View File
@@ -1,13 +1,20 @@
# tez-utils-str # tez-utils-str
[![CI](https://github.com/tezmanian/tez-utils-str/actions/workflows/php.yml/badge.svg)](https://github.com/tezmanian/tez-utils-str/actions/workflows/php.yml)
[![Packagist Version](https://img.shields.io/packagist/v/tezmanian/utils-str)](https://packagist.org/packages/tezmanian/utils-str)
[![PHP](https://img.shields.io/packagist/php-v/tezmanian/utils-str)](https://packagist.org/packages/tezmanian/utils-str)
[![License: MIT](https://img.shields.io/packagist/l/tezmanian/utils-str)](LICENSE)
Focused PHP string utilities: case conversion, template interpolation, masking, cryptographically secure random strings, URL slugs, and multibyte-aware truncation. PHP 8.3+, no dependencies. Focused PHP string utilities: case conversion, template interpolation, masking, cryptographically secure random strings, URL slugs, and multibyte-aware truncation. PHP 8.3+, no dependencies.
## Installation ## Installation
```bash ```bash
composer require tez/utils-str composer require tezmanian/utils-str
``` ```
Package: [`tezmanian/utils-str`](https://packagist.org/packages/tezmanian/utils-str) · Namespace: `Tezmanian\Utils\Str`
## Components ## Components
| Class | Purpose | | Class | Purpose |
@@ -26,7 +33,7 @@ composer require tez/utils-str
Converts any supported format (camelCase, PascalCase, snake_case, kebab-case, SCREAMING_SNAKE_CASE) into any other. All formats are interchangeable. Converts any supported format (camelCase, PascalCase, snake_case, kebab-case, SCREAMING_SNAKE_CASE) into any other. All formats are interchangeable.
```php ```php
use Tez\Utils\Str\CaseConverter; use Tezmanian\Utils\Str\CaseConverter;
CaseConverter::toSnake('userProfileName'); // 'user_profile_name' CaseConverter::toSnake('userProfileName'); // 'user_profile_name'
CaseConverter::toSnake('UserProfileName'); // 'user_profile_name' CaseConverter::toSnake('UserProfileName'); // 'user_profile_name'
@@ -49,7 +56,7 @@ CaseConverter::toSnake('HTMLParser'); // 'html_parser'
Replaces `{placeholders}` in a template string with values from an array. Supports dot-notation for nested keys. Throws `InvalidArgumentException` for missing keys by default; a fallback can be provided. Replaces `{placeholders}` in a template string with values from an array. Supports dot-notation for nested keys. Throws `InvalidArgumentException` for missing keys by default; a fallback can be provided.
```php ```php
use Tez\Utils\Str\Interpolate; use Tezmanian\Utils\Str\Interpolate;
Interpolate::render( Interpolate::render(
'Hello {name}, you have {count} messages.', 'Hello {name}, you have {count} messages.',
@@ -80,7 +87,7 @@ Interpolate::render('Hello :name!', ['name' => 'Bob'], prefix: ':', suffix: '');
Masks sensitive strings for display in logs, UIs, and API responses. Masks sensitive strings for display in logs, UIs, and API responses.
```php ```php
use Tez\Utils\Str\Mask; use Tezmanian\Utils\Str\Mask;
// Email — keeps first character of the local part // Email — keeps first character of the local part
Mask::email('test@example.com'); // 't***@example.com' Mask::email('test@example.com'); // 't***@example.com'
@@ -107,7 +114,7 @@ Mask::custom('HelloWorld', start: 2, end: 2, char: '#'); // 'He######ld'
Generates cryptographically secure random strings using `random_bytes()`. Uses rejection sampling for uniform distribution — no modulo bias. Generates cryptographically secure random strings using `random_bytes()`. Uses rejection sampling for uniform distribution — no modulo bias.
```php ```php
use Tez\Utils\Str\Random; use Tezmanian\Utils\Str\Random;
// Hex token (lowercase [0-9a-f]) // Hex token (lowercase [0-9a-f])
Random::token(); // 32-character hex string (default) Random::token(); // 32-character hex string (default)
@@ -132,7 +139,7 @@ Throws `InvalidArgumentException` when `$length < 1` or the charset is empty.
Converts text to a URL-safe slug. Transliterates common non-ASCII characters (German umlauts, French accents, Spanish ñ, Nordic æøå, and more) before lowercasing and replacing non-alphanumeric characters. Converts text to a URL-safe slug. Transliterates common non-ASCII characters (German umlauts, French accents, Spanish ñ, Nordic æøå, and more) before lowercasing and replacing non-alphanumeric characters.
```php ```php
use Tez\Utils\Str\Slugify; use Tezmanian\Utils\Str\Slugify;
Slugify::slug('Hello World'); // 'hello-world' Slugify::slug('Hello World'); // 'hello-world'
Slugify::slug('Ärger mit Umlauten!'); // 'aerger-mit-umlauten' Slugify::slug('Ärger mit Umlauten!'); // 'aerger-mit-umlauten'
@@ -154,7 +161,7 @@ Slugify::slug('Hello World', '_'); // 'hello_world'
Multibyte-aware truncation. By default snaps back to the last complete word so no word is split. The total result length (including suffix) never exceeds `$limit`. Multibyte-aware truncation. By default snaps back to the last complete word so no word is split. The total result length (including suffix) never exceeds `$limit`.
```php ```php
use Tez\Utils\Str\Truncate; use Tezmanian\Utils\Str\Truncate;
// Word-boundary truncation (default) // Word-boundary truncation (default)
Truncate::chars('The quick brown fox jumps over the lazy dog', 20); Truncate::chars('The quick brown fox jumps over the lazy dog', 20);
@@ -189,6 +196,15 @@ Throws `InvalidArgumentException` when `$limit` is shorter than the suffix lengt
- PHP 8.3+ - PHP 8.3+
- No runtime dependencies - No runtime dependencies
## Development
```bash
make build && make install
make ci # audit, PHPStan, code style, tests
```
## License ## License
MIT MIT — see [LICENSE](LICENSE).
Author: René Halberstadt
+21 -3
View File
@@ -1,16 +1,34 @@
{ {
"name": "tez/utils-str", "name": "tezmanian/utils-str",
"type": "library", "type": "library",
"description": "Focused PHP string utilities: case conversion, template interpolation, masking, cryptographically secure random strings, URL slugs, and multibyte-aware truncation. PHP 8.3+, no dependencies.", "description": "Focused PHP string utilities: case conversion, template interpolation, masking, cryptographically secure random strings, URL slugs, and multibyte-aware truncation. PHP 8.3+, no dependencies.",
"keywords": [
"string",
"slug",
"mask",
"random",
"php"
],
"homepage": "https://github.com/tezmanian/tez-utils-str",
"license": "MIT", "license": "MIT",
"authors": [
{
"name": "René Halberstadt",
"email": "tezmanian@gmail.com"
}
],
"support": {
"issues": "https://github.com/tezmanian/tez-utils-str/issues",
"source": "https://github.com/tezmanian/tez-utils-str"
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Tez\\Utils\\Str\\": "src/" "Tezmanian\\Utils\\Str\\": "src/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Tez\\Utils\\Tests\\Str\\": "tests/" "Tezmanian\\Utils\\Tests\\Str\\": "tests/"
} }
}, },
"require": { "require": {
Generated
-4566
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Str; namespace Tezmanian\Utils\Str;
final class CaseConverter final class CaseConverter
{ {
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Str; namespace Tezmanian\Utils\Str;
final class Interpolate final class Interpolate
{ {
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Str; namespace Tezmanian\Utils\Str;
final class Mask final class Mask
{ {
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Str; namespace Tezmanian\Utils\Str;
final class Random final class Random
{ {
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Str; namespace Tezmanian\Utils\Str;
final class Slugify final class Slugify
{ {
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Str; namespace Tezmanian\Utils\Str;
final class Truncate final class Truncate
{ {
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Tests\Str; namespace Tezmanian\Utils\Tests\Str;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Tez\Utils\Str\CaseConverter; use Tezmanian\Utils\Str\CaseConverter;
final class CaseConverterTest extends TestCase final class CaseConverterTest extends TestCase
{ {
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Tests\Str; namespace Tezmanian\Utils\Tests\Str;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Tez\Utils\Str\Interpolate; use Tezmanian\Utils\Str\Interpolate;
final class InterpolateTest extends TestCase final class InterpolateTest extends TestCase
{ {
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Tests\Str; namespace Tezmanian\Utils\Tests\Str;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Tez\Utils\Str\Mask; use Tezmanian\Utils\Str\Mask;
final class MaskTest extends TestCase final class MaskTest extends TestCase
{ {
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Tests\Str; namespace Tezmanian\Utils\Tests\Str;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Tez\Utils\Str\Random; use Tezmanian\Utils\Str\Random;
final class RandomTest extends TestCase final class RandomTest extends TestCase
{ {
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Tests\Str; namespace Tezmanian\Utils\Tests\Str;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Tez\Utils\Str\Slugify; use Tezmanian\Utils\Str\Slugify;
final class SlugifyTest extends TestCase final class SlugifyTest extends TestCase
{ {
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Tez\Utils\Tests\Str; namespace Tezmanian\Utils\Tests\Str;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Tez\Utils\Str\Truncate; use Tezmanian\Utils\Str\Truncate;
final class TruncateTest extends TestCase final class TruncateTest extends TestCase
{ {