PHPackages                             bitsnbolts/laravel-collection-macros - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bitsnbolts/laravel-collection-macros

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bitsnbolts/laravel-collection-macros
====================================

A set of useful Laravel collection macros

3.0.0(6mo ago)13.0k1MITPHPPHP ^7.1|^8.0|^8.1|^8.2|^8.3CI failing

Since Mar 11Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/bitsnbolts/laravel-collection-macros)[ Packagist](https://packagist.org/packages/bitsnbolts/laravel-collection-macros)[ Docs](https://github.com/bitsnbolts/laravel-collection-macros)[ RSS](/packages/bitsnbolts-laravel-collection-macros/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (13)Used By (0)

Laravel Collection Macros
=========================

[](#laravel-collection-macros)

[![Latest Version on Packagist](https://camo.githubusercontent.com/84a26850293bcbc7768850009208fab64fefdabebf819fe68b90cbfe78060417/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626974736e626f6c74732f6c61726176656c2d636f6c6c656374696f6e2d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bitsnbolts/laravel-collection-macros)[![Build Status](https://camo.githubusercontent.com/d6749673176a21d82ec93b5f8844c4d163c99eee606254099ca4cc3fbb09630d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f626974736e626f6c74732f6c61726176656c2d636f6c6c656374696f6e2d6d6163726f732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bitsnbolts/laravel-collection-macros)[![Quality Score](https://camo.githubusercontent.com/4b8df42108f504dbac94d93da8d4edc707c96c428245fd30563be77bad6a2285/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f626974736e626f6c74732f6c61726176656c2d636f6c6c656374696f6e2d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bitsnbolts/laravel-collection-macros)[![Total Downloads](https://camo.githubusercontent.com/b029181d41748d1d5174d62823122fae67ffb17cc798ce31c9cc6b8225895561/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626974736e626f6c74732f6c61726176656c2d636f6c6c656374696f6e2d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bitsnbolts/laravel-collection-macros)

This repository contains some useful collection macros.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require bitsnbolts/laravel-collection-macros
```

Usage
-----

[](#usage)

### `replaceInKeys`

[](#replaceinkeys)

Do a find and replace on all the keys of the collection.

```
$data = new Collection(['foo_bar' => 1]);
$data->replaceInKeys('_', ' '); // Collection(['foo bar' => 1])
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Thijs van den Anker](https://github.com/thijsvdanker)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance66

Regular maintenance activity

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 87% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~225 days

Recently: every ~393 days

Total

12

Last Release

197d ago

Major Versions

1.1.0 → 2.0.02020-01-14

2.6.0 → 3.0.02025-12-19

PHP version history (5 changes)1.0.0PHP ^7.1

2.3.0PHP ^7.1|^8.0

2.4.0PHP ^7.1|^8.0|^8.1

2.6.0PHP ^7.1|^8.0|^8.1|^8.2

3.0.0PHP ^7.1|^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/4395242ced08362b402e6117b60fe23df915df83e48b9b6bb8940b31ea55a660?d=identicon)[thijsvdanker](/maintainers/thijsvdanker)

---

Top Contributors

[![thijsvdanker](https://avatars.githubusercontent.com/u/429548?v=4)](https://github.com/thijsvdanker "thijsvdanker (20 commits)")[![philipboeken](https://avatars.githubusercontent.com/u/32740847?v=4)](https://github.com/philipboeken "philipboeken (3 commits)")

---

Tags

laravel-collection-macrosbitsnbolts

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bitsnbolts-laravel-collection-macros/health.svg)

```
[![Health](https://phpackages.com/badges/bitsnbolts-laravel-collection-macros/health.svg)](https://phpackages.com/packages/bitsnbolts-laravel-collection-macros)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M375](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

244.6M136](/packages/illuminate-cookie)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
