Rename namespace to Tezmanian and prepare for Packagist
PHP Composer / build (push) Successful in 33s
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:
@@ -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-str
|
||||
|
||||
[](https://github.com/tezmanian/tez-utils-str/actions/workflows/php.yml)
|
||||
[](https://packagist.org/packages/tezmanian/utils-str)
|
||||
[](https://packagist.org/packages/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.
|
||||
|
||||
## Installation
|
||||
|
||||
```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
|
||||
|
||||
| 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.
|
||||
|
||||
```php
|
||||
use Tez\Utils\Str\CaseConverter;
|
||||
use Tezmanian\Utils\Str\CaseConverter;
|
||||
|
||||
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.
|
||||
|
||||
```php
|
||||
use Tez\Utils\Str\Interpolate;
|
||||
use Tezmanian\Utils\Str\Interpolate;
|
||||
|
||||
Interpolate::render(
|
||||
'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.
|
||||
|
||||
```php
|
||||
use Tez\Utils\Str\Mask;
|
||||
use Tezmanian\Utils\Str\Mask;
|
||||
|
||||
// Email — keeps first character of the local part
|
||||
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.
|
||||
|
||||
```php
|
||||
use Tez\Utils\Str\Random;
|
||||
use Tezmanian\Utils\Str\Random;
|
||||
|
||||
// Hex token (lowercase [0-9a-f])
|
||||
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.
|
||||
|
||||
```php
|
||||
use Tez\Utils\Str\Slugify;
|
||||
use Tezmanian\Utils\Str\Slugify;
|
||||
|
||||
Slugify::slug('Hello World'); // 'hello-world'
|
||||
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`.
|
||||
|
||||
```php
|
||||
use Tez\Utils\Str\Truncate;
|
||||
use Tezmanian\Utils\Str\Truncate;
|
||||
|
||||
// Word-boundary truncation (default)
|
||||
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+
|
||||
- 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
|
||||
|
||||
+21
-3
@@ -1,16 +1,34 @@
|
||||
{
|
||||
"name": "tez/utils-str",
|
||||
"name": "tezmanian/utils-str",
|
||||
"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.",
|
||||
"keywords": [
|
||||
"string",
|
||||
"slug",
|
||||
"mask",
|
||||
"random",
|
||||
"php"
|
||||
],
|
||||
"homepage": "https://github.com/tezmanian/tez-utils-str",
|
||||
"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": {
|
||||
"psr-4": {
|
||||
"Tez\\Utils\\Str\\": "src/"
|
||||
"Tezmanian\\Utils\\Str\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tez\\Utils\\Tests\\Str\\": "tests/"
|
||||
"Tezmanian\\Utils\\Tests\\Str\\": "tests/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
|
||||
Generated
-4566
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Str;
|
||||
namespace Tezmanian\Utils\Str;
|
||||
|
||||
final class CaseConverter
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Str;
|
||||
namespace Tezmanian\Utils\Str;
|
||||
|
||||
final class Interpolate
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Str;
|
||||
namespace Tezmanian\Utils\Str;
|
||||
|
||||
final class Mask
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Str;
|
||||
namespace Tezmanian\Utils\Str;
|
||||
|
||||
final class Random
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Str;
|
||||
namespace Tezmanian\Utils\Str;
|
||||
|
||||
final class Slugify
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Str;
|
||||
namespace Tezmanian\Utils\Str;
|
||||
|
||||
final class Truncate
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Tests\Str;
|
||||
namespace Tezmanian\Utils\Tests\Str;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tez\Utils\Str\CaseConverter;
|
||||
use Tezmanian\Utils\Str\CaseConverter;
|
||||
|
||||
final class CaseConverterTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Tests\Str;
|
||||
namespace Tezmanian\Utils\Tests\Str;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tez\Utils\Str\Interpolate;
|
||||
use Tezmanian\Utils\Str\Interpolate;
|
||||
|
||||
final class InterpolateTest extends TestCase
|
||||
{
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Tests\Str;
|
||||
namespace Tezmanian\Utils\Tests\Str;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tez\Utils\Str\Mask;
|
||||
use Tezmanian\Utils\Str\Mask;
|
||||
|
||||
final class MaskTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Tests\Str;
|
||||
namespace Tezmanian\Utils\Tests\Str;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tez\Utils\Str\Random;
|
||||
use Tezmanian\Utils\Str\Random;
|
||||
|
||||
final class RandomTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Tests\Str;
|
||||
namespace Tezmanian\Utils\Tests\Str;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tez\Utils\Str\Slugify;
|
||||
use Tezmanian\Utils\Str\Slugify;
|
||||
|
||||
final class SlugifyTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tez\Utils\Tests\Str;
|
||||
namespace Tezmanian\Utils\Tests\Str;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tez\Utils\Str\Truncate;
|
||||
use Tezmanian\Utils\Str\Truncate;
|
||||
|
||||
final class TruncateTest extends TestCase
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user