reedware/laravel-modern-factories
Bring Laravel 8-style class-based model factories to legacy Laravel (5.1–7.x) apps. Write modern PHPUnit-friendly factories today to reduce upgrade pain later, without facades or service providers. Supports PHP 5.5–8.4.
new(), for(), state definitions) in older Laravel versions, accelerating test coverage and reducing technical debt.Adopt When:
afterCreating, sequence).Look Elsewhere If:
For Executives: "This package lets us modernize our legacy Laravel application’s testing infrastructure without a costly full upgrade. By adopting Laravel 8-style factories today, we can write more reliable tests, reduce bugs, and set the stage for a smoother future migration—all while keeping our current system stable. It’s a low-risk way to invest in technical debt reduction and future-proof our codebase."
For Engineering Teams:
*"This is a drop-in solution to use Laravel 8’s factory syntax (e.g., User::factory()->create()) in Laravel 5–7. It eliminates the ‘tax’ of rewriting factories during upgrades and lets us:
For Developers:
*"No more hacky factory workarounds! This package lets you use Laravel 8’s factory methods (like new(), for(), and state definitions) in older Laravel versions. It’s perfect if:
new keyword in Laravel 5.6).sequence() or afterCreating() without upgrading.composer require it, and you’re ready to write modern tests. Docs mirror Laravel 8’s, so the learning curve is minimal."*How can I help you explore Laravel packages today?