Skip to content

Wildcards

Wildcards allow you to match multiple items in arrays and collections using the * symbol. They work across all Data Helpers classes and enable powerful bulk operations.

Use * to match any single segment at that position:

$data = [
'users' => [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@example.com'],
],
];
$accessor = new DataAccessor($data);
$emails = $accessor->get('users.*.email');

Multiple * can appear in one path:

$skus = $accessor->get('orders.*.items.*.sku');

Use SQL-like operators with wildcards:

  • WHERE - Filter items
  • ORDER BY - Sort items
  • LIMIT/OFFSET - Pagination
  • GROUP BY - Aggregations
  • DISTINCT - Remove duplicates

See DataMapper for detailed examples.