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

- 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:46 +02:00
parent 4c8660ad8c
commit 5ed0113590
43 changed files with 121 additions and 98 deletions
+1 -1
View File
@@ -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
+37 -21
View File
@@ -1,13 +1,20 @@
# tez-utils-arr
[![CI](https://github.com/tezmanian/tez-utils-arr/actions/workflows/php.yml/badge.svg)](https://github.com/tezmanian/tez-utils-arr/actions/workflows/php.yml)
[![Packagist Version](https://img.shields.io/packagist/v/tezmanian/utils-arr)](https://packagist.org/packages/tezmanian/utils-arr)
[![PHP](https://img.shields.io/packagist/php-v/tezmanian/utils-arr)](https://packagist.org/packages/tezmanian/utils-arr)
[![License: MIT](https://img.shields.io/packagist/l/tezmanian/utils-arr)](LICENSE)
A collection of focused, stateless array utility classes for PHP 8.3+. Each class does one thing and exposes a clean static API.
## Installation
```bash
composer require tez/utils-arr
composer require tezmanian/utils-arr
```
Package: [`tezmanian/utils-arr`](https://packagist.org/packages/tezmanian/utils-arr) · Namespace: `Tezmanian\Utils\Arr`
## Components
| Class | Purpose |
@@ -38,7 +45,7 @@ composer require tez/utils-arr
Recursively compares two arrays and returns all differences with dot-notation paths.
```php
use Tez\Utils\Arr\ArrayDiff;
use Tezmanian\Utils\Arr\ArrayDiff;
$result = ArrayDiff::compare(
['user' => ['name' => 'Alice', 'age' => 30]],
@@ -66,7 +73,7 @@ Comparison is strict (`1 !== "1"`). Keys are reported as `ChangeType::Added`, `C
Computes the Cartesian product of any number of sets lazily via a Generator.
```php
use Tez\Utils\Arr\CartesianProduct;
use Tezmanian\Utils\Arr\CartesianProduct;
foreach (CartesianProduct::create(['S', 'M', 'L'], ['red', 'blue']) as $tuple) {
// ['S', 'red'], ['S', 'blue'], ['M', 'red'], ...
@@ -82,7 +89,7 @@ No intermediate array is built — suitable for large input sets.
Recursively merges override arrays into a base array. Multiple overrides are applied left to right.
```php
use Tez\Utils\Arr\DeepMerge;
use Tezmanian\Utils\Arr\DeepMerge;
$result = DeepMerge::merge(
['db' => ['host' => 'localhost', 'port' => 3306]],
@@ -100,7 +107,7 @@ String keys are merged recursively when both sides are arrays. Integer keys are
Returns the first or last item matching a predicate.
```php
use Tez\Utils\Arr\Find;
use Tezmanian\Utils\Arr\Find;
$first = Find::first($users, fn($u) => $u['active']);
$last = Find::last($users, fn($u) => $u['active']);
@@ -114,7 +121,7 @@ $last = Find::last($users, fn($u) => $u['active']);
Flattens a nested array into a single list. Accepts an optional depth limit.
```php
use Tez\Utils\Arr\Flatten;
use Tezmanian\Utils\Arr\Flatten;
Flatten::flatten([1, [2, [3, 4]]]); // [1, 2, 3, 4]
Flatten::flatten([1, [2, [3, 4]]], depth: 1); // [1, 2, [3, 4]]
@@ -127,7 +134,7 @@ Flatten::flatten([1, [2, [3, 4]]], depth: 1); // [1, 2, [3, 4]]
Groups items by a key derived from a callback.
```php
use Tez\Utils\Arr\GroupBy;
use Tezmanian\Utils\Arr\GroupBy;
$grouped = GroupBy::group($orders, fn($o) => $o['status']);
// ['pending' => [...], 'shipped' => [...]]
@@ -140,7 +147,7 @@ $grouped = GroupBy::group($orders, fn($o) => $o['status']);
Builds an associative lookup map from a list. When two items produce the same key, the last wins.
```php
use Tez\Utils\Arr\KeyBy;
use Tezmanian\Utils\Arr\KeyBy;
$byId = KeyBy::index($users, fn($u) => $u['id']);
// [42 => $user, 99 => $user, ...]
@@ -153,7 +160,7 @@ $byId = KeyBy::index($users, fn($u) => $u['id']);
Maps over an array where the callback returns a `[key => value]` pair.
```php
use Tez\Utils\Arr\MapWithKeys;
use Tezmanian\Utils\Arr\MapWithKeys;
$result = MapWithKeys::map($products, fn($p) => [$p['sku'] => $p['price']]);
// ['ABC-1' => 9.99, 'XYZ-2' => 4.49]
@@ -166,7 +173,7 @@ $result = MapWithKeys::map($products, fn($p) => [$p['sku'] => $p['price']]);
Paginates an array and returns an immutable `Page` with slice and metadata.
```php
use Tez\Utils\Arr\Paginator;
use Tezmanian\Utils\Arr\Paginator;
$page = Paginator::paginate($items, page: 2, perPage: 15);
@@ -187,7 +194,7 @@ Throws `InvalidArgumentException` when `$page < 1` or `$perPage < 1`.
Splits an array into two lists in a single pass — items passing the predicate first, failing items second.
```php
use Tez\Utils\Arr\Partition;
use Tezmanian\Utils\Arr\Partition;
[$active, $inactive] = Partition::by($users, fn($u) => $u['active']);
```
@@ -199,7 +206,7 @@ use Tez\Utils\Arr\Partition;
Extracts values from an array of records using dot-notation keys.
```php
use Tez\Utils\Arr\Pluck;
use Tezmanian\Utils\Arr\Pluck;
// Extract a single column
Pluck::values($users, 'name'); // ['Alice', 'Bob', ...]
@@ -221,7 +228,7 @@ Items where the key is absent are silently skipped.
Safely reads typed values from deeply nested arrays using dot-notation paths. Returns `null` (or a default) when any segment is missing.
```php
use Tez\Utils\Arr\SafeGet;
use Tezmanian\Utils\Arr\SafeGet;
$data = ['chart' => ['result' => [['meta' => ['currency' => 'EUR']]]]];
@@ -241,7 +248,7 @@ Integer-looking segments (e.g. `"0"`) address list indices automatically.
Produces consecutive overlapping windows of a fixed size.
```php
use Tez\Utils\Arr\Sliding;
use Tezmanian\Utils\Arr\Sliding;
Sliding::window([1, 2, 3, 4, 5], size: 3);
// [[1,2,3], [2,3,4], [3,4,5]]
@@ -257,7 +264,7 @@ Sliding::window([1, 2, 3, 4, 5], size: 3, step: 2);
Sorts a copy of the array by a derived key. Never mutates the original. Result is always re-indexed.
```php
use Tez\Utils\Arr\SortBy;
use Tezmanian\Utils\Arr\SortBy;
$sorted = SortBy::sort($products, fn($p) => $p['price']);
$desc = SortBy::sort($products, fn($p) => $p['price'], descending: true);
@@ -270,7 +277,7 @@ $desc = SortBy::sort($products, fn($p) => $p['price'], descending: true);
Swaps rows and columns of a 2D array. All rows must have the same column count.
```php
use Tez\Utils\Arr\Transpose;
use Tezmanian\Utils\Arr\Transpose;
Transpose::matrix([[1, 2, 3], [4, 5, 6]]);
// [[1, 4], [2, 5], [3, 6]]
@@ -283,7 +290,7 @@ Transpose::matrix([[1, 2, 3], [4, 5, 6]]);
Removes duplicates where uniqueness is determined by a callback.
```php
use Tez\Utils\Arr\UniqueBy;
use Tezmanian\Utils\Arr\UniqueBy;
// Keep first occurrence (default)
UniqueBy::filter($items, fn($i) => $i['email']);
@@ -302,7 +309,7 @@ UniqueBy::filter($items, fn($i) => $i['email'], preserveKeys: true);
Ensures any value is an array. `null` becomes `[]`, arrays pass through, everything else gets wrapped.
```php
use Tez\Utils\Arr\Wrap;
use Tezmanian\Utils\Arr\Wrap;
Wrap::ensure(null); // []
Wrap::ensure('hello'); // ['hello']
@@ -316,7 +323,7 @@ Wrap::ensure([1, 2]); // [1, 2]
Combines multiple arrays element-by-element into a list of tuples.
```php
use Tez\Utils\Arr\Zip;
use Tezmanian\Utils\Arr\Zip;
// Pad shorter arrays with null
Zip::zip([1, 2, 3], ['a', 'b']);
@@ -332,8 +339,17 @@ Zip::shortest([1, 2, 3], ['a', 'b']);
## Requirements
- PHP 8.3+
- `tez/utils-enum` ^1.0
- [`tezmanian/utils-enum`](https://packagist.org/packages/tezmanian/utils-enum) ^1.0
## Development
```bash
make build && make install
make ci # audit, PHPStan, code style, tests
```
## License
MIT
MIT — see [LICENSE](LICENSE).
Author: René Halberstadt
+21 -14
View File
@@ -1,31 +1,38 @@
{
"name": "tez/utils-arr",
"name": "tezmanian/utils-arr",
"type": "library",
"description": "A set of focused PHP array utilities: grouping, pagination, diffing, sorting, partitioning, flattening, cartesian products, and more — PHP 8.3+, no framework required.",
"keywords": [
"array",
"collection",
"utilities",
"php"
],
"homepage": "https://github.com/tezmanian/tez-utils-arr",
"license": "MIT",
"authors": [
{
"name": "René Halberstadt",
"email": "tezmanian@gmail.com"
}
],
"support": {
"issues": "https://github.com/tezmanian/tez-utils-arr/issues",
"source": "https://github.com/tezmanian/tez-utils-arr"
},
"autoload": {
"psr-4": {
"Tez\\Utils\\Arr\\": "src/"
"Tezmanian\\Utils\\Arr\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tez\\Utils\\Tests\\Arr\\": "tests/"
"Tezmanian\\Utils\\Tests\\Arr\\": "tests/"
}
},
"repositories": [
{
"type": "git",
"url": "https://gitea.root-zone.info/tez/tez-utils-enum.git"
},
{
"type": "git",
"url": "https://github.com/tezmanian/tez-utils-enum.git"
}
],
"require": {
"php": ">=8.3",
"tez/utils-enum": "^1.0"
"tezmanian/utils-enum": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^11.0",
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class ArrayDiff
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
/**
* Computes the Cartesian product of any number of sets lazily via a Generator.
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
/**
* Represents a single difference between two arrays at a specific dot-notation path.
+2 -2
View File
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
use Tez\Utils\Enum\BackedEnumTrait;
use Tezmanian\Utils\Enum\BackedEnumTrait;
/**
* Classifies the type of a single difference detected by ArrayDiff.
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class DeepMerge
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
/**
* Immutable result of an ArrayDiff comparison.
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Find
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Flatten
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class GroupBy
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class KeyBy
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class MapWithKeys
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
/**
* Immutable result of a paginated array slice.
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Paginator
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Partition
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Pluck
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
/**
* Safely read deeply nested values from an array using dot-notation paths.
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Sliding
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class SortBy
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Transpose
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class UniqueBy
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Wrap
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Tez\Utils\Arr;
namespace Tezmanian\Utils\Arr;
final class Zip
{
+4 -4
View File
@@ -2,12 +2,12 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\ArrayDiff;
use Tez\Utils\Arr\ChangeType;
use Tez\Utils\Arr\DiffResult;
use Tezmanian\Utils\Arr\ArrayDiff;
use Tezmanian\Utils\Arr\ChangeType;
use Tezmanian\Utils\Arr\DiffResult;
final class ArrayDiffTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\CartesianProduct;
use Tezmanian\Utils\Arr\CartesianProduct;
final class CartesianProductTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\DeepMerge;
use Tezmanian\Utils\Arr\DeepMerge;
final class DeepMergeTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Find;
use Tezmanian\Utils\Arr\Find;
final class FindTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Flatten;
use Tezmanian\Utils\Arr\Flatten;
final class FlattenTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\GroupBy;
use Tezmanian\Utils\Arr\GroupBy;
final class GroupByTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\KeyBy;
use Tezmanian\Utils\Arr\KeyBy;
final class KeyByTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\MapWithKeys;
use Tezmanian\Utils\Arr\MapWithKeys;
final class MapWithKeysTest extends TestCase
{
+3 -3
View File
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Page;
use Tez\Utils\Arr\Paginator;
use Tezmanian\Utils\Arr\Page;
use Tezmanian\Utils\Arr\Paginator;
final class PaginatorTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Partition;
use Tezmanian\Utils\Arr\Partition;
final class PartitionTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Pluck;
use Tezmanian\Utils\Arr\Pluck;
final class PluckTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\SafeGet;
use Tezmanian\Utils\Arr\SafeGet;
final class SafeGetTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Sliding;
use Tezmanian\Utils\Arr\Sliding;
final class SlidingTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\SortBy;
use Tezmanian\Utils\Arr\SortBy;
final class SortByTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Transpose;
use Tezmanian\Utils\Arr\Transpose;
final class TransposeTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\UniqueBy;
use Tezmanian\Utils\Arr\UniqueBy;
final class UniqueByTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Wrap;
use Tezmanian\Utils\Arr\Wrap;
final class WrapTest extends TestCase
{
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Tez\Utils\Tests\Arr;
namespace Tezmanian\Utils\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Tez\Utils\Arr\Zip;
use Tezmanian\Utils\Arr\Zip;
final class ZipTest extends TestCase
{