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

Laravel Modern Factories

This package brings modern Laravel Factories (circa Laravel 8) to older versions of Laravel, with the aim of helping legacy applications update to modern Laravel.

Laravel Version PHP Version Build

Usage of Laravel 7 and older is waning, but it ain't zero. Trying to upgrade? Maybe this package can help.

Laravel Installs

Table of Contents

Introduction

If you're still using Laravel 7 or older, you already know that it's high time to upgrade, but let's be real, there's probably some roadblocks in the way. One of the roadblocks I've been faced having confidence that I don't break anything when upgrading. There are a few tools to combat this:

This package is meant to aid your investment in automated testing via PHPUnit. When you're behind on your version of Laravel, you've got technical debt. Usually, upgrading your version of Laravel is a common blocker for multiple avenues of addressing your technical debt. That said, if you're paying down your technical debt by writing automated tests using legacy Laravel Factories, there's effectively a tax associated with every payment, as once you get to Laravel 8, you'll be pressured to upgrade to modern Laravel Factories. You can use laravel/legacy-factories to keep moving forward with your legacy factories, but let's be real, that's not what you want either.

Installation

Install this package using composer:

composer require reedware/laravel-modern-factories

This package doesn't use any facades or service providers.

Versioning

This package targets the feature set of Laravel 8.x Eloquent Factories. If you're on Laravel 8 or greater, don't use this package; just use the native Eloquent Factories.

The following Laravel and PHP versions are supported:

Package Laravel PHP
1.x 5.1 - 7.x 5.5 - 7.4
2.x 6.x - 7.x 8.0 - 8.4

Usage

Refer to the Laravel 8.x Documentation on Eloquent Factories. This package autoloads into the Illuminate\Database\Eloquent\Factories namespace (which isn't used prior to Laravel 8), so the documentation can be followed verbatim.

Changes for 5.6 or Older

The new and for keywords are not allowed as method names. You can use newFactory and forModel instead. Newer versions of PHP (7.0 or greater) can use the new and for methods as-is.

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