PHPackages                             bjnstnkvc/builder-make-command - 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. bjnstnkvc/builder-make-command

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

bjnstnkvc/builder-make-command
==============================

Generate Eloquent Builder class for enhanced query building and model scope management.

1.0.9(1y ago)041MITPHP

Since Feb 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/BJNSTNKVC/laravel-builder-make-command)[ Packagist](https://packagist.org/packages/bjnstnkvc/builder-make-command)[ RSS](/packages/bjnstnkvc-builder-make-command/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (11)Used By (0)

Laravel make:builder Command
============================

[](#laravel-makebuilder-command)

Generate Eloquent Builder class for enhanced query building and model scope management.

Features
--------

[](#features)

- Dynamic query methods for `where`, `whereIn`, `whereLike`, `whereNot`, `whereNotIn`, `whereNotLike`, `orWhere`, `orWhereIn`, `orWhereLike`, `orWhereNot`, `orWhereNotIn` and `orWhereNotLike`.
- Simplifies the construction of complex queries with readable method chains.
- Automatically handles method calls that are not natively supported by Laravel Query Builder by transforming them into appropriate query conditions.

Installation &amp; setup
------------------------

[](#installation--setup)

You can install the package via composer:

```
composer require bjnstnkvc/builder-make-command
```

The package will automatically register its service provider.

In case you would like to change the package defaults, you can do so by publishing the config:

```
php artisan vendor:publish --provider="Bjnstnkvc\BuilderMakeCommand\BuilderMakeCommandServiceProvider" --tag=make-builder-config
```

or stubs

```
php artisan vendor:publish --provider="Bjnstnkvc\BuilderMakeCommand\BuilderMakeCommandServiceProvider" --tag=make-builder-stubs
```

Usage
-----

[](#usage)

Once the package has been installed, you can run it via CLI the same way you would for any of the other CLI commands.

```
php artisan make:builder UserBuilder
```

By default, the command will try figure out the name of the model from the name of the builder (E.g. `UserBuilder` will attempt to look for `User` model).

Additionally, you can pass a model name as a second argument.

```
php artisan make:builder UserBuilder User
```

In case the Builder already exists, you can pass an optional `--force` argument which will overwrite the existing class.

```
php artisan make:builder UserBuilder User --force
```

> **Note**: By forcing the Builder command, all custom methods you've added to the Builder will be overwritten so be cautious.

If you simply call the command, without any arguments, Laravel will prompt you for input.

```
php artisan make:builder
```

```
What should the builder be named?
> UserBuilder
```

```
What is the model name? [User]
>
```

```
Overwrite existing file? (yes/no) [no]
>
```

> The name of the Model has been derived from the Builder name and set as a default. Confirm by pressing ENTER or enter the name of the Model.
>
> In case the file already exists, you will be prompted whether you would like to overwrite the existing file.

Once the command has been run, the Builder class will be created inside `app\Models\Builders` folder.

In order to use it inside your models, add `HasDynamicBuilder` trait to your model:

```
use Bjnstnkvc\BuilderMakeCommand\Concerns\HasDynamicBuilder;

class User extends Model
{
    use HasDynamicBuilder;
}
```

Once added, dynamic where clauses for every Model column is added as an Eloquent method.

```
User::whereId(mixed $operator = null, mixed $value = null, string $boolean = 'and');
User::whereIdNot(mixed $operator = null, mixed $value = null, string $boolean = 'and');
User::whereIdIn(array $values, string $boolean = 'and', bool $not = false);
User::whereIdNotIn(array $values, string $boolean = 'and');
User::whereIdLike(string $value, bool $caseSensitive = false, string $boolean = 'and', bool $not = false);
User::whereIdNotLike(string $value, bool $caseSensitive = false, string $boolean = 'and', bool $not = false);
User::orWhereId(mixed $operator = null, mixed $value = null);
User::orWhereIdNot(mixed $operator = null, mixed $value = null);
User::orWhereIdIn(array $values);
User::orWhereIdNotIn(array $values);
User::orWhereIdLike(string $value, bool $caseSensitive = false);
User::orWhereIdNotLike(string $value, bool $caseSensitive = false);

// Methods for other database columns.
```

Naturally, these methods can be chained on:

```
User::whereId(1)
    ->orWhereNameNot('John')
    ->first();
```

```
User::whereId('>', 1)
    ->orWhereEmail('email@example.com')
    ->first();
```

In case you need to group several "where" clauses within parentheses in order to achieve your query's desired Logical Grouping, you can do the following:

```
use App\Models\Builders\UserBuilder;

User::whereName('John')
    ->where(function (UserBuilder $query) {
        $query->whereEmail('email@example.com')
              ->orWhereTitle('Admin');
    })
    ->first();
```

In case you would like to generate the Builder method signatures as a mixin, you can use the `--mixin` flag:

```
php artisan make:builder UserBuilder User --mixin
```

The mixin will be created inside `.builder.mixin.php` file and automatically imported into the Builder class.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance49

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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 ~48 days

Recently: every ~5 days

Total

10

Last Release

370d ago

### Community

Maintainers

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

---

Top Contributors

[![BJNSTNKVC](https://avatars.githubusercontent.com/u/104220595?v=4)](https://github.com/BJNSTNKVC "BJNSTNKVC (52 commits)")

---

Tags

buildereloquentlaravelqueryscopelaraveleloquentquerybuilderscope

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bjnstnkvc-builder-make-command/health.svg)

```
[![Health](https://phpackages.com/badges/bjnstnkvc-builder-make-command/health.svg)](https://phpackages.com/packages/bjnstnkvc-builder-make-command)
```

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)[mpyw/laravel-local-class-scope

A tiny macro that reuse a global scope class as a local scope

24102.6k](/packages/mpyw-laravel-local-class-scope)[cerbero/query-filters

Filter Laravel Eloquent models based on query parameters.

85282.6k](/packages/cerbero-query-filters)[baril/bonsai

An implementation of the Closure Tables pattern for Eloquent.

3593.5k](/packages/baril-bonsai)

PHPackages © 2026

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