PHPackages                             pepperfm/macros-for-laravel - 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. pepperfm/macros-for-laravel

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

pepperfm/macros-for-laravel
===========================

A small macro registry for Laravel facades / macroable classes.

0.0.5(2mo ago)0557↓45%MITPHPPHP ^8.4

Since Jan 19Pushed 2mo agoCompare

[ Source](https://github.com/pepperfm/macros-for-laravel)[ Packagist](https://packagist.org/packages/pepperfm/macros-for-laravel)[ RSS](/packages/pepperfm-macros-for-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (14)Versions (6)Used By (0)

Laravel Macros
==============

[](#laravel-macros)

Small macro registry for Laravel facades and Macroable classes. It lets you enable macro groups via config and register everything automatically at boot.

Install
-------

[](#install)

```
composer r pepperfm/macros-for-laravel
```

Laravel auto-discovers the provider: `Pepperfm\LaravelMacros\Providers\LaravelMacrosServiceProvider`.

Publish config
--------------

[](#publish-config)

```
php artisan vendor:publish --tag=macros-for-laravel-config
```

`config/macros-for-laravel.php`:

```
return [
    'enabled' => env('MACROS_ENABLED', true),
    'profile' => env('MACROS_PROFILE', 'default'),
    'conflicts' => 'throw', // throw | overwrite
    'unreachable' => 'throw', // throw | skip
    'profiles' => [
        'default' => [
            \Pepperfm\LaravelMacros\Groups\Support\ArrCastMacros::class => true,
            \Pepperfm\LaravelMacros\Groups\Support\ArrNativeMacros::class => false,
            \Pepperfm\LaravelMacros\Groups\Support\CollectionMacros::class => true,
        ],
        // 'http' => [
        //     \Pepperfm\LaravelMacros\Groups\Facades\ResponseMacros::class => true,
        // ],
    ],
];
```

Switch profiles via env:

```
MACROS_PROFILE=http
```

You can also use the legacy top-level groups list (no profiles):

```
'groups' => [
    \Pepperfm\LaravelMacros\Groups\Support\ArrCastMacros::class => true,
];
```

Built-in macros
---------------

[](#built-in-macros)

### Arr cast helpers

[](#arr-cast-helpers)

Available when `ArrCastMacros` is enabled:

```
Arr::bool($array, 'flag');
Arr::int($array, 'count');
Arr::toFloat($array, 'ratio');
Arr::toString($array, 'name', null, true);
Arr::toArray($array, 'items');
Arr::toEnum($array, 'status', Status::class, $default = null);
```

### Arr native array helpers

[](#arr-native-array-helpers)

Available when `ArrNativeMacros` is enabled:

```
Arr::values($array);
Arr::keys($array);
Arr::keyFirst($array);
Arr::keyLast($array);
Arr::flip($array);
Arr::combine(['a', 'b'], [1, 2]);
Arr::unique(['a', 'a', 'b']);
Arr::reverse([1, 2, 3]);
```

### Collection paginate

[](#collection-paginate)

Available when `CollectionMacros` is enabled:

```
collect([1, 2, 3])->paginate(2);
```

### Collection filters

[](#collection-filters)

Available when `CollectionMacros` is enabled:

```
collect([1, null, 2])->filterNotNull();
collect(['', ' ', 'ok', null])->filterNotBlank();
```

Custom groups
-------------

[](#custom-groups)

Create a group that implements `Pepperfm\LaravelMacros\Contracts\MacroGroupContract`, then add it to a profile (or to `groups` in legacy mode). It will be resolved via the container.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance88

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~14 days

Total

5

Last Release

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87b33c1f84ded521a768afdbd204f1a1c2cd7519477a2f8bdb2e8b7cba030d09?d=identicon)[PepperFM](/maintainers/PepperFM)

---

Top Contributors

[![pepperfm](https://avatars.githubusercontent.com/u/36007880?v=4)](https://github.com/pepperfm "pepperfm (5 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/pepperfm-macros-for-laravel/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)

PHPackages © 2026

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