spatie/laravel-collection-macros
Adds a curated set of handy macros to Laravel Collections, extending them with extra helper methods (e.g., positional accessors like second/third, after, getNth, and more). Auto-registers via Composer for quick, drop-in productivity boosts.
Add Laravel 13 support
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/8.0.1...8.0.2
firstOrFail() macro by @jivanf in https://github.com/spatie/laravel-collection-macros/pull/253Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/8.0.0...8.0.1
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.14.2...8.0.0
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.14.1...7.14.2
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.14.0...7.14.1
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.13.1...7.14.0
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.13.0...7.13.1
hasCaseSensitive and getCaseSensitiveFull Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.12.4...7.12.5
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.12.3...7.12.4
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.12.1...7.12.2
Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.12.0...7.12.1
containsAny and containsAll by @freekmurze and @michaelnabil230Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.11.0...7.12.0
if macroinsertAt macro (#209)pluckMany (#207)firstOrPushDO NOT USE: incorrectly tagged
try and catch macroscollect() macro to collectBy() to resolve Laravel 6 compatibilitypaginate for pages other than 1paginate for pages other than 1prioritize will keep the keys of the original itemjoin macrohead macroparallels macro tests fixfirstOrFail will return the item instead of a collectionrange macroeachConspluckToArrayparallelMap return a new collectionTransposeparallelMap to be configuredparallelMapfindOrFailtranspose when using an empty arraytranspose when using an Arrayabletranspose when using a single-row matrixatrotatefilterMapglob macrodd and dump macrosgroupByModel and sectionBy$itemsKey and $preserveKeys parameters to groupByModeltail, eachCons, sliceBefore and chunkBysectionBysectionByextract now returns an instance of the current collection typeextractpaginate and simplePaginatebefore and aftercollecttoPairs and withSizesplit, partition and mapToAssoctoAssoc to fromPairspartition methodsplit doesn't throw an error anymore when trying to split an empty collectionversion_compare fix in 5.3 changescomposer.json errordump macrotranspose will throw an exception when invalid input is given and it'll return a collection of collectionstranspose macroassoc and toAssoc macrosifAny and ifEmptypath macro by @michael-rubel in https://github.com/spatie/laravel-collection-macros/pull/220Full Changelog: https://github.com/spatie/laravel-collection-macros/compare/7.8.0...7.9.0
join method as the same implementation has been added to LaravelHow can I help you explore Laravel packages today?