# spatie/laravel-collection-macros

A set of useful Laravel collection macros

Repository: https://github.com/spatie/laravel-collection-macros
Canonical: https://ross.abutalabs.com/products/laravel-collection-macros
Homepage: https://freek.dev/540-some-handy-collection-macros
Language: PHP
License: NOASSERTION
License Family: other
Topics: laravel, php, collection, macros, hacktoberfest
Last push: 2026-02-20T20:46:35+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 68, release rhythm 47, longevity 100
- inputs: {"age_days": 3690, "days_push": 194, "days_rel": 194, "gap_med": 93.0, "n_releases_24m": 5}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1910, forks 144 (observed 2026-08-28T04:05:53.114447+00:00)

## What it is
A Spatie PHP package that adds a set of handy macros to Laravel's collection class, such as after, at, filterMap, validate, split, and dd. It installs via Composer and automatically registers itself with a Laravel application.

## Use cases
- add extra methods to Laravel collections
- validate every item in a collection with a rule
- split a collection into a given number of groups
- debug collection contents with dd
- map and filter collections in one pass
- group collection items by Eloquent model

## When to choose
- you use Laravel and repeatedly write the same collection helper logic
- you want well-tested, community-maintained collection extensions
- you want expressive collection operations like eachCons, extract, or fromPairs

## When to avoid
- you don't use the Laravel framework
- you only need one or two trivial helpers you can write yourself
- you need framework-agnostic collection utilities outside Laravel

## Facets
- artifact type: library
- maturity: active
- function: developer-tools
- domain: web-development, developer-tools
- platform: php
- tags: laravel, collections, macros, spatie, php-package

## Member repositories
- spatie/laravel-collection-macros (main) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:53.114447+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:11:04.763312+00:00, confidence not recorded.
  - readme: https://github.com/spatie/laravel-collection-macros (fetched 2026-08-28T04:05:53.114447+00:00, sha 236a16f3055d)
  - homepage: https://freek.dev/540-some-handy-collection-macros (fetched 2026-08-29T10:50:00.972658+00:00, sha 34d9db93f627)
  - site_page: https://freek.dev/about (fetched 2026-08-29T10:50:00.981723+00:00, sha e0ef9dccbb05)
- Data as of 2026-08-30T08:39:29.467469+00:00.
