Download the PHP package alison4kk/items without Composer
On this page you can find all versions of the php package alison4kk/items. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alison4kk/items
More information about alison4kk/items
Files in alison4kk/items
Package items
Short Description Items - Hybrid array manipulation utility for PHP 7.4+ and PHP 8
License MIT
Informations about the package items
Items
Hybrid array/object manipulation library for PHP 7.4+ and PHP 8 with:
- Static immutable operations
- Static in-place operations
- Fluent instance operations
- Dot notation for nested arrays/objects (
user.address.city)
Installation
For local development:
Quick start
API Reference
Filter (search, find matching items)
Static immutable:
Static in-place:
Fluent in-place:
Returns array or instance with only items matching all conditions.
Sort (order items)
Static immutable:
Static in-place:
Fluent in-place:
Supports 'ASC' and 'DESC' directions. Works with dot notation paths.
Map (transform items)
Static immutable:
Static in-place:
Fluent in-place:
Mapper receives ($item, $key) and returns transformed value.
Unique (remove duplicates)
Static immutable:
Static in-place:
Fluent in-place:
Removes duplicate items based on field or callable key.
Index (create indexed map)
Static immutable:
Static in-place:
Fluent in-place:
Changes array keys to values from a field or callable.
Group (organize by field)
Static immutable:
Static in-place:
Fluent in-place:
Reorganizes array into groups keyed by field values.
Column (extract column)
Static:
Fluent:
Extract values from a field or callable into a new array.
Find (get first/last matching)
Returns first/last item optionally matching condition.
Check (test conditions)
Test if all/any items match, or if any item contains all search fields.
Count & Sum
Aggregate operations. Count optionally filters by condition.
Group Aggregates
Count/sum items grouped by field.
Transform Keys/Values
Create key-value maps or transform keys using callable.
Dot Notation (nested access)
Static:
Fluent:
Access nested arrays and objects using dot notation:
Conditions Format
Pass conditions as associative arrays (all must match):
Or as indexed arrays with operators:
Data Types
Works with arrays and objects (using stdClass or custom classes). All methods support:
- Nested arrays and objects
- Mixed structures
- Dot notation paths like
user.profile.address.zip
Testing
All 46 tests validate filter, sort, map, unique, group, index, find, count, sum, average, min, max, grouping aggregates, key-value operations, and dot notation functionality.
PHP Version
Requires PHP 7.4+ with full PHP 8.x support.
License
MIT
This package is compatible with PHP 7.4+ and PHP 8.x, and uses PHPDoc generics (@template) instead of union/mixed type declarations.