A PHP library that wraps arrays in a chainable map object with sorting, filtering, grouping, and jQuery-style method calls on collections.
Overview
PHP Map is a library for working with PHP arrays through an array-like collection object, similar in spirit to jQuery and Laravel Collections. You create a map from arrays or JSON, then chain methods to add, remove, filter, sort, group, and transform data without repetitive native array calls.
The API is large and grouped into areas such as create, access, add, aggregate, order, shorten, test, and mutate. Callbacks can be passed into many methods. When elements are objects, you can invoke their methods across the collection and receive a new map of results, described as a jQuery-style workflow.
Supported PHP versions are listed as PHP 8+ for the 4.x line and PHP 7.1+ for 3.x. Installation is via Composer under the aimeos/map package name. Documentation on the project site walks through replacing common array_column, array_filter, and sort patterns with chained map operations.
Key features
- Chainable map object
- Sort filter and group
- Key-value column mapping
- JSON import and export
- Callback-driven methods
- Object method delegation
- Tree structure helper
- Large collection API
Use cases
- PHP collection pipelines
- Array refactor to objects
- Data transform in PHP apps
- Laravel-style collections
- List aggregation in backends