Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Collection Macros Laravel Package

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.

View on GitHub
Deep Wiki
Context7
8.1.0

Add Laravel 13 support

7.13.0
  • add hasCaseSensitive and getCaseSensitive
  • drop support for older PHP and Laravel versions
  • refactor tests to Pest
7.12.4
7.12.3
  • support L10
7.12.0
7.11.0
7.10.0
  • support Laravel 9
7.9.0
7.7.0
  • add if macro
7.5.0
  • add insertAt macro (#209)
7.4.0
  • add pluckMany (#207)
7.3.0
  • add firstOrPush
6.3.1
  • add PHP 8 support
6.3.0

DO NOT USE: incorrectly tagged

  • add PHP 8 support
7.2.0
  • add getNth macro (#201)
7.1.0
  • add support for PHP 8
7.0.3
  • add support for Laravel 8
7.0.2
  • improve second, third, ... marcros
7.0.1
  • use registry over file scan + string manipulation (#179)
7.0.0
  • drop support for Laravel 6
  • drop support for PHP 7.3 and below
6.2.0
  • add try and catch macros
6.1.0
  • Laravel 7 support
6.0.0
  • Laravel 6 support
  • Renamed collect() macro to collectBy() to resolve Laravel 6 compatibility
5.0.1
  • fix paginate for pages other than 1
4.3.2
  • fix paginate for pages other than 1
5.0.0
  • prioritize will keep the keys of the original item
  • drop support for Laravel 5.7 and below
  • drop support for PHP 7.1 and below
4.3.1
  • add support for Laravel 5.8
4.3.0
  • add join macro
4.2.0
  • add head macro
4.1.0
  • add methods to get items by human named indexes
4.0.1
  • parallels macro tests fix
4.0.0
  • firstOrFail will return the item instead of a collection
  • support for Laravel 5.7
  • removed range macro
3.8.1
  • Fixed: maximum function nesting reached error in eachCons
3.8.0
  • Added: Laravel 5.6 compatibility
3.7.0
  • Added: pluckToArray
3.6.2
  • Fixed: Make parallelMap return a new collection
3.6.1
  • Fixed: Count warning/exception php7.2 in Transpose
3.6.0
  • Added: Allow worker pool of parallelMap to be configured
3.5.0
  • Added: parallelMap
3.4.0
  • Added: findOrFail
3.3.2
  • Fixed: transpose when using an empty array
  • Fixed: transpose when using an Arrayable
3.3.1
  • Fixed: transpose when using a single-row matrix
3.3.0
  • Added: at
3.2.0
  • Added: rotate
3.1.0
  • Added: filterMap
3.0.0
  • Added: support for Laravel 5.5, removed support for older versions
  • Added: glob macro
  • Removed: dd and dump macros
  • Changed: Parameter order for groupByModel and sectionBy
2.7.0
  • Added: $itemsKey and $preserveKeys parameters to groupByModel
2.6.0
  • Added: tail, eachCons, sliceBefore and chunkBy
2.5.0
  • Added: customization options for sectionBy
2.4.0
  • Added: sectionBy
2.3.1
  • Fixed: extract now returns an instance of the current collection type
2.3.0
  • Added: extract
2.2.0
  • Added: paginate and simplePaginate
2.1.0
  • Added: before and after
  • Added: collect
2.0.1
  • Added: toPairs and withSize
  • Removed: split, partition and mapToAssoc
  • Renamed: toAssoc to fromPairs
1.5.0
  • Added: partition method
1.4.4
  • Fixed: split doesn't throw an error anymore when trying to split an empty collection
1.4.3
  • Fixed: version_compare fix in 5.3 changes
1.4.2
  • Added: Laravel 5.3 compatibility
1.4.1
  • Maintenance release to kickstart Packagist after composer.json error
1.4.0
  • Added: dump macro
1.3.1
  • Changed: transpose will throw an exception when invalid input is given and it'll return a collection of collections
1.3.0
  • Added: transpose macro
1.2.0
  • Added: assoc and toAssoc macros
1.1.0
  • Changed: The collection will be passed to the callbacks of ifAny and ifEmpty
1.0.0
  • Initial release
1.5.1
  • Fixed: Tests
5.0.2
  • require laravel 5.8.4
  • remove join method as the same implementation has been added to Laravel
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport