PHPackages                             wadakatu/laravel-factory-refactor - 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. wadakatu/laravel-factory-refactor

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

wadakatu/laravel-factory-refactor
=================================

Refactor the style of factory call from helper to static method for Laravel 8.x.

v2.1.0(3y ago)1128MITPHPPHP &gt;=7.3CI passing

Since Jan 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/wadakatu/laravel-factory-refactor)[ Packagist](https://packagist.org/packages/wadakatu/laravel-factory-refactor)[ Docs](https://github.com/wadakatu/laravel-factory-refactor)[ RSS](/packages/wadakatu-laravel-factory-refactor/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (5)Versions (163)Used By (0)

Laravel-Factory-Refactor
========================

[](#laravel-factory-refactor)

[![GitHub release (latest by date)](https://camo.githubusercontent.com/d9df72bf3968e6fde6591a2e59a1b18271122723a9f9dc6712ba21984f55ce0a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f776164616b6174752f6c61726176656c2d666163746f72792d7265666163746f723f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/wadakatu/laravel-factory-refactor)[![Packagist PHP Version Support](https://camo.githubusercontent.com/70adfd0b0736665e577e5f76dd771f821466a389911fdb75cd3ca1bda33ae1e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f776164616b6174752f6c61726176656c2d666163746f72792d7265666163746f72)](https://packagist.org/packages/wadakatu/laravel-factory-refactor)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/wadakatu/laravel-factory-refactor/blob/main/LICENSE)

This package will help you to refactor the style of factory call from helper to static method for Laravel 10.x, 11.x, 12.x..

With this package, you can save plenty of time and focus on other important things.

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

[](#installation)

Install the package via composer:

```
composer require wadakatu/laravel-factory-refactor --dev
```

How to Use
----------

[](#how-to-use)

To refactor the style of factory call from helper to static method, run the artisan command:

```
php artisan refactor:factory
```

Options
-------

[](#options)

By default, all factory call under `tests/` directory are the target of refactoring.

If you want to change the target directory, you can do that by using the `--dir` option.

```
php artisan refactor:factory --dir tests/Feature
```

---

By default, `Tests\\` namespace is the target of refactoring.

If you want to change the target namespace, you can do that by using the `--namespace` option.

```
php artisan refactor:factory --dir app/Models　--namespace App\\Models
```

---

Example
-------

[](#example)

### Before

[](#before)

```
        factory(User::class)->make();
        factory(App\Models\User::class)->make();
        factory(User::class, 10)->make();
        factory(App\Models\User::class, 10)->make();
        factory($model)->make();
        factory(User::class, $count['user'])->make();
```

### After

[](#after)

```
        User::factory()->make();
        App\Models\User::factory()->make();
        User::factory()->count(10)->make();
        App\Models\User::factory()->count(10)->make();
        $model::factory()->make();
        User::factory()->count($count['user'])->make();
```

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 66.6% 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 ~96 days

Recently: every ~119 days

Total

6

Last Release

1138d ago

Major Versions

v1.3.0 → v2.0.02022-04-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/6fc976536b6b21ad39ca38269c6c59eceabc5fd57d6627e6742279cff53c387a?d=identicon)[wadakatu](/maintainers/wadakatu)

---

Top Contributors

[![wadakatu](https://avatars.githubusercontent.com/u/72595463?v=4)](https://github.com/wadakatu "wadakatu (317 commits)")[![gitlyte[bot]](https://avatars.githubusercontent.com/u/72595463?v=4)](https://github.com/gitlyte[bot] "gitlyte[bot] (159 commits)")

---

Tags

factorylaravelphp7php8refactorlaravelfactoryrefactoringtestsrefactorfactories

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wadakatu-laravel-factory-refactor/health.svg)

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M203](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[laravel/folio

Page based routing for Laravel.

603583.7k33](/packages/laravel-folio)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)[thedoctor0/laravel-factory-generator

Automatically generate Laravel factories for your models.

2151.1M1](/packages/thedoctor0-laravel-factory-generator)

PHPackages © 2026

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