Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Modern Factories Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Legacy System Modernization: Enables incremental upgrades of Laravel 5.1–7.x applications by adopting modern factory patterns without full version upgrades, reducing migration risk.
  • Test-Driven Development (TDD) for Legacy Code: Allows teams to adopt Laravel 8-style factories (e.g., new(), for(), state definitions) in older Laravel versions, accelerating test coverage and reducing technical debt.
  • Build vs. Buy: Avoids reinventing factory logic for legacy systems while sidestepping the complexity of full Laravel upgrades. Justifies investment in testing without immediate infrastructure overhauls.
  • Roadmap for Future-Proofing: Bridges the gap between legacy systems and modern Laravel, making it easier to eventually migrate to Laravel 8+ by familiarizing teams with its factory syntax.
  • Use Cases:
    • Legacy application maintenance teams needing to adopt testing without full upgrades.
    • Startups or small teams with Laravel 5–7 apps that lack resources for major version jumps.
    • CI/CD pipelines requiring modern factory syntax for consistency across environments.

When to Consider This Package

  • Adopt When:

    • Your team is maintaining Laravel 5.1–7.x and wants to adopt modern factory patterns for testing (e.g., stateful factories, afterCreating, sequence).
    • You’re prioritizing test coverage but lack the budget/time for a full Laravel upgrade.
    • Your application uses PHPUnit and needs Laravel 8-style factories without breaking compatibility.
    • You’re in the early stages of a phased migration and want to reduce risk by modernizing incrementally.
  • Look Elsewhere If:

    • You’re already on Laravel 8+ (use native factories).
    • Your team lacks PHPUnit or testing infrastructure (this package assumes a testing-first approach).
    • You’re using Laravel Shift or other upgrade tools that handle factory compatibility natively.
    • Your legacy codebase is too fragmented to justify even incremental modernization (e.g., no test suite, monolithic spaghetti code).
    • You need advanced factory features (e.g., custom state resolution) not covered by Laravel 8’s syntax.

How to Pitch It (Stakeholders)

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:

  • Write cleaner, more maintainable tests.
  • Adopt modern patterns incrementally.
  • Avoid vendor lock-in by using standard Laravel syntax. The package is lightweight, MIT-licensed, and aligns with our long-term goal of moving to Laravel 8+. Let’s pilot it in our legacy modules to see how it accelerates testing efforts."*

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:

  • You’re tired of legacy factory quirks (e.g., no new keyword in Laravel 5.6).
  • You want to use sequence() or afterCreating() without upgrading.
  • You’re preparing for a future Laravel 8+ migration. Just composer require it, and you’re ready to write modern tests. Docs mirror Laravel 8’s, so the learning curve is minimal."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky