PHPackages                             signifly/laravel-builder-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. [Database &amp; ORM](/categories/database)
4. /
5. signifly/laravel-builder-macros

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

signifly/laravel-builder-macros
===============================

A set of useful Laravel builder macros.

v2.0.0(2y ago)2811.0k4MITPHPPHP ^7.2.5|^8.0

Since Aug 8Pushed 2y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

A set of useful Laravel builder macros
======================================

[](#a-set-of-useful-laravel-builder-macros)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8b762260dc993f11fa58fd60d6ff8148ef403312734574160a0b6159e7f7bbd0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369676e69666c792f6c61726176656c2d6275696c6465722d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/signifly/laravel-builder-macros)[![Tests](https://github.com/signifly/laravel-builder-macros/workflows/Tests/badge.svg)](https://github.com/signifly/laravel-builder-macros/workflows/Tests/badge.svg)[![StyleCI](https://camo.githubusercontent.com/d5f091903f04f75345644d23e2a097c8804a23166d7feac6dd8d8b5661c8a91d/68747470733a2f2f7374796c6563692e696f2f7265706f732f3134343031373431382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/144017418)[![Quality Score](https://camo.githubusercontent.com/ca14946fc7b93e119757536750eade52591ea3e9536d4e87166065d30b6d3694/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7369676e69666c792f6c61726176656c2d6275696c6465722d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/signifly/laravel-builder-macros)[![Total Downloads](https://camo.githubusercontent.com/37ba601d51752cf13495853049481bb93a7e7505b2c9abb829fb55ab52f67f48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369676e69666c792f6c61726176656c2d6275696c6465722d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/signifly/laravel-builder-macros)

The `signifly/laravel-builder-macros` package allows you to easily add a set of useful builder macros to your Laravel app.

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

[](#installation)

You can install the package via composer:

```
composer require signifly/laravel-builder-macros
```

The package will automatically register itself.

Macros
------

[](#macros)

- [`addSubSelect`](#addSubSelect)
- [`defaultSelectAll`](#defaultSelectAll)
- [`joinRelation`](#joinRelation)
- [`leftJoinRelation`](#leftJoinRelation)
- [`map`](#map)
- [`whereLike`](#whereLike)

### `addSubSelect`

[](#addsubselect)

Add a select sub query.

```
// Params: $column, $query
$query->addSubSelect('primary_address_id',
    Address::select('id')
        ->where('user_id', $user->id)
        ->primary()
);

// It adds primary_address_id to the result set
```

### `defaultSelectAll`

[](#defaultselectall)

It selects all columns from the query. Useful for queries with joins and additional selects.

```
$query->defaultSelectAll()
    ->join('contacts', 'users.id', '=', 'contacts.user_id')
    ->addSelect('contacts.name as contact_name');
```

### `joinRelation`

[](#joinrelation)

A query way to join relations.

```
// Params: $relationName, $operator
$query->joinRelation('contact');
```

### `leftJoinRelation`

[](#leftjoinrelation)

A query to left join relations.

```
// Params: $relationName, $operator
$query->leftJoinRelation('contact');
```

### `map`

[](#map)

A direct method to retrieve the results and map it.

```
$userIds = $query->where('user_id', 10)->map(function ($user) {
    return $user->id;
});

// Returns a collection
```

### `whereLike`

[](#wherelike)

Search in your models with the `LIKE` operator.

```
$query->whereLike('title', 'john')->get();

// Returns all results where title  includes `john`
```

You can also supply an array of columns to search in:

```
$query->whereLike(['title', 'contact.name'], 'john')->get();

// Returns all results where title or contact.name includes `john`
```

Testing
-------

[](#testing)

```
composer test
```

Security
--------

[](#security)

If you discover any security issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Morten Poul Jensen](https://github.com/pactode)
- [All contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~148 days

Recently: every ~339 days

Total

14

Last Release

904d ago

Major Versions

v1.4.3 → v2.0.02023-11-21

PHP version history (3 changes)v1.0.0PHP ^7.1

v1.4.0PHP ^7.2.5

v1.4.3PHP ^7.2.5|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd06d3bd4452ca3ce5c956b4c0bcb1240ca692f590bc4cdabe104fd07156e0bf?d=identicon)[signifly](/maintainers/signifly)

---

Top Contributors

[![pactode](https://avatars.githubusercontent.com/u/5956778?v=4)](https://github.com/pactode "pactode (24 commits)")[![Razorsheep](https://avatars.githubusercontent.com/u/459217?v=4)](https://github.com/Razorsheep "Razorsheep (3 commits)")[![Androlax2](https://avatars.githubusercontent.com/u/39646949?v=4)](https://github.com/Androlax2 "Androlax2 (1 commits)")[![emilhorlyck](https://avatars.githubusercontent.com/u/25416509?v=4)](https://github.com/emilhorlyck "emilhorlyck (1 commits)")[![ibmgeniuz](https://avatars.githubusercontent.com/u/64996874?v=4)](https://github.com/ibmgeniuz "ibmgeniuz (1 commits)")

---

Tags

eloquenteloquent-builderlaravelmacros

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/signifly-laravel-builder-macros/health.svg)

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

###  Alternatives

[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[aglipanci/laravel-eloquent-case

Adds CASE statement support to Laravel Query Builder.

115157.2k](/packages/aglipanci-laravel-eloquent-case)

PHPackages © 2026

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