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(2y ago)1108MITPHPPHP &gt;=7.3CI passing

Since Jan 27Pushed 10mo 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 1mo ago

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 75% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity11

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

1085d 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

[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)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[thedoctor0/laravel-factory-generator

Automatically generate Laravel factories for your models.

214997.4k1](/packages/thedoctor0-laravel-factory-generator)[mpociot/laravel-test-factory-helper

Generate Laravel test factories from your existing models

933635.2k2](/packages/mpociot-laravel-test-factory-helper)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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