PHPackages                             jimchen/laravel-macro - 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. jimchen/laravel-macro

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

jimchen/laravel-macro
=====================

Laravel Macro Helper

v0.1.0(7y ago)39MITPHPPHP &gt;=7.0

Since Sep 13Pushed 7y ago2 watchersCompare

[ Source](https://github.com/JimChenWYU/laravel-macro)[ Packagist](https://packagist.org/packages/jimchen/laravel-macro)[ RSS](/packages/jimchen-laravel-macro/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

laravel-macro
=============

[](#laravel-macro)

[![Build Status](https://camo.githubusercontent.com/cb6e51f3e9442d89a4985e4594add028b376f55393a2098882ba6b2847313b09/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4a696d4368656e5759552f6c61726176656c2d6d6163726f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/JimChenWYU/laravel-macro)

Laravel Macro Helper

Installing
----------

[](#installing)

```
$ composer require jimchen/laravel-macro -vvv
```

The package will automatically register itself.

If you use Laravel 5.1.\*, you can add the service provider to the providers array in `config/app.php`.

```
JimChen\Macro\LaravelMacroServiceProvider::class,
```

Usage
-----

[](#usage)

You should publish the config file to add macros.

```
$ php artisan vendor:publish --provider="JimChen\Macro\LaravelMacroServiceProvider"
```

Binding macro class to macroable class in `config/macro.php`.

```
return [
    'macros' => [
        'Illuminate\Support\Arr' => [
            'App\Macros\Arr',
        ]
    ],
];
```

Define macro file, `app/Macros/Arr1.php`.

```
namespace App\Macro;

class Arr
{
    public static function merge($a, $b)
    {
        return array_merge($a, $b);
    }
}
```

Using in anywhere if you need. Great!

For example in `app/routes/web.php`

```
use Illuminate\Support\Arr;

Route::get('/', function () {
    $foo = [1, 2];
    $bar = [3, 4];

    $result = Arr::merge($foo, $bar);

    dd($result);  // [1, 2, 3, 4]
});
```

License
-------

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2798d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20cebafc45fd6fc5f67bf655119a3b27e9b208e248f2d7f5c98fd6c0a101485b?d=identicon)[jimchen](/maintainers/jimchen)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jimchen-laravel-macro/health.svg)

```
[![Health](https://phpackages.com/badges/jimchen-laravel-macro/health.svg)](https://phpackages.com/packages/jimchen-laravel-macro)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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