PHPackages                             chinleung/laravel-factory-builder - 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. chinleung/laravel-factory-builder

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

chinleung/laravel-factory-builder
=================================

A package to use factories like an Eloquent builder.

v1.2.0(6y ago)0800MITPHPPHP ^7.4CI failing

Since Mar 2Pushed 6y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Laravel Factory Builder
=======================

[](#laravel-factory-builder)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9b46e6f27f966cb8b1b0b26d0c04c729690c0aac3edb5fb2868f8d22212fc193/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368696e6c65756e672f6c61726176656c2d666163746f72792d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chinleung/laravel-factory-builder)[![Quality Score](https://camo.githubusercontent.com/77563bae1a4bdcd6c68c82600053846fd63b30f1bd1df79854448c8f2cfecdaf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6368696e6c65756e672f6c61726176656c2d666163746f72792d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/chinleung/laravel-factory-builder)[![Total Downloads](https://camo.githubusercontent.com/6347a2ca58bffc3cb017ab0a41c2e73cd912413f7753e8105f44a90d7ee1dfff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368696e6c65756e672f6c61726176656c2d666163746f72792d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chinleung/laravel-factory-builder)

A package to allow you to use your factories like an Eloquent builder inspired from [Tighten](https://tighten.co/blog/tidy-up-your-tests-with-class-based-model-factories).

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

[](#installation)

You can install the package via composer:

```
composer require --dev chinleung/laravel-factory-builder
```

Configuration
-------------

[](#configuration)

By default, the builder will fetch the models from `App\\` namespace if none has been provided in your builder.

```
php artisan vendor:publish --provider="ChinLeung\Factories\FactoriesServiceProvider" --tag="config"
```

Quick Usage
-----------

[](#quick-usage)

### Basic

[](#basic)

```
use Tests\Factories\UserFactory;

$user = app(UserFactory::class)->create();
```

### Real-Time Facade

[](#real-time-facade)

```
use Facades\Tests\Factories\UserFactory;

$user = UserFactory::create();
```

Methods
-------

[](#methods)

The builder comes with a few methods available for you to use.

### create(int $count = null)

[](#createint-count--null)

> Create one or more instances of the model.

### make(int $count = null)

[](#makeint-count--null)

> Create one or more instances of the model without saving it in the database.

### created(Model $model): Model

[](#createdmodel-model-model)

> Hook to alter the model after it has been created. For instance, creating relationships related to the model.

### setProperty(string $property, $value): self

[](#setpropertystring-property-value-self)

> Set a property for the creation of the model.

### getProperties(): array

[](#getproperties-array)

> Retrieve the properties used for the model creation.

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

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

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Chin Leung](https://github.com/chinleung)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Total

3

Last Release

2207d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40590fe8b8c82dfac2530c6f0c0c39dd1dded4c3ad136e15ef2cf3bb20304dad?d=identicon)[ChinLeung](/maintainers/ChinLeung)

---

Top Contributors

[![chinleung](https://avatars.githubusercontent.com/u/19669331?v=4)](https://github.com/chinleung "chinleung (14 commits)")

---

Tags

laravellaravel-packagechinleunglaravel-factory-builder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chinleung-laravel-factory-builder/health.svg)

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

###  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.

9446.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)
