Weave 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

Factory Laravel Package

analogue/factory

A lightweight model factory for Laravel that generates fake Eloquent model instances for testing and seeding, with a fluent API for defining attribute blueprints, sequences, and relationships so you can quickly build realistic test data.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit Analogue is a data-mapper ORM, whereas Laravel's factory system was designed around Eloquent's active-record lifecycle (newInstance, save, model events, mass assignment). This package exists solely to bridge that impedance mismatch: it lets Illuminate\Database\Eloquent\Factory definitions resolve and persist Analogue entities through Analogue's mapper/entity-manager instead of an Eloquent model. Architectural fit is therefore narrow and conditional — it is appropriate only for a Laravel application that has deliberately adopted Analogue as its persistence layer and still relies on Laravel's string-based factory DSL for test and seed data. For any Eloquent-based application, or any application using modern class-based factories, the package adds no value.

Integration feasibility Integration is a Composer require alongside analogue/analogue and illuminate/database, plus service-provider registration and likely factory-builder substitution. Feasibility is constrained by release vintage: the last release is February 2018, which places it in the Laravel 5.5–5.8 era and pre-dates Laravel 8's class-based factory rewrite. Successful integration depends on pinning a compatible Laravel/PHP matrix and confirming that analogue/analogue itself resolves. Because the package has 1 star and 0 dependents, there is no observable production usage to validate the integration path.

Technical risk

  • API obsolescence (high): Laravel 8+ replaced $factory->define(...) with Illuminate\Database\Eloquent\Factories\Factory classes; this package targets the former. It is unlikely to work unmodified on supported Laravel versions.
  • Upstream abandonment (high): No release since 2018 and effectively no community. Security and compatibility fixes will not arrive.
  • Dependency coupling (medium): It is coupled to two moving targets — Analogue internals and Laravel's database component — both of which have moved substantially.
  • Validation gap (medium): One star and zero dependents mean no peer review, no issue history of substance, and no failure-mode documentation.
  • Licensing (low): MIT is permissive and compatible with commercial use, including forking.

Key questions

  1. Which Laravel and PHP versions must this application support, and is Laravel 8+ class-based factory support a hard requirement?
  2. Is Analogue already the persistence layer, or is this being considered for an Eloquent application? (If the latter, stop.)
  3. Does the existing test suite depend on factory states, sequences, relationships, or model events that this bridge may not faithfully reproduce?
  4. Are we prepared to fork and own the package, or is there an internal alternative (per-entity builders, direct Faker usage, or a thin custom persister)?
  5. What is the actual cost of the bridge versus rewriting the affected factories?

Integration Approach

Stack fit The only defensible fit is a legacy Laravel monolith (roughly 5.5–5.8, PHP 7.x) that already uses Analogue and has an established factory-based test suite. In a greenfield or modern stack, the correct move is to avoid the package entirely and implement test-data construction directly against Analogue's mapper.

Migration path

  • If Analogue is already in place: adopt incrementally, one factory at a time, behind a feature branch, verifying entity persistence and relationship resolution against the existing test suite.
  • If Analogue is not in place: do not migrate to it for this package's sake. The package is a test-data convenience, not a reason to adopt a data-mapper ORM.
  • If modernizing Laravel: plan to replace this bridge with class-based factories that delegate persistence to a small internal adapter around Analogue's mapper. This is likely a few hundred lines and removes the dependency risk.

Compatibility Verify Composer constraints for illuminate/database, analogue/analogue, and PHP before committing. Expect a ceiling below Laravel 8 and below PHP 8; test on the oldest and newest versions in the supported matrix. Confirm the package's factory builder correctly handles Analogue's entity manager lifecycle, transaction boundaries, and any timestamp or event behavior the test suite assumes.

Sequencing

  1. Confirm Laravel/PHP/Analogue version compatibility in an isolated branch.
  2. Port a single low-risk factory and run its dependent tests.
  3. Expand to relationship-heavy and state-heavy factories, since these are where the bridge is most likely to diverge from Eloquent semantics.
  4. Decide: retain, fork-and-patch, or replace with an internal adapter.
  5. Document the decision and the supported version matrix so future upgrades do not silently break test infrastructure.

Operational Impact

Maintenance Effectively zero upstream maintenance. Treat the package as vendored code: fork it into the organization's namespace, pin the fork, and budget for occasional patches when Laravel or Analogue dependencies shift. The maintenance cost is small in absolute terms but non-zero and permanent.

Support There is no vendor, no active maintainer, and no community to escalate to. Internal ownership must be explicit. Incidents will be diagnosed by whichever engineer owns the test infrastructure, which concentrates knowledge risk.

Scaling The package affects test-data generation only, not production runtime, so horizontal scaling is not a concern. The relevant scaling constraints are suite runtime and memory when seeding large datasets through Analogue's entity manager, plus the friction of adding factories as the domain model grows. Watch for per-factory overhead that compounds in large suites.

Failure modes

  • Factory model resolution failures when entity class names or namespaces differ from Eloquent conventions.
  • Silent divergence from Eloquent semantics: missing model events, timestamps, mass-assignment behavior, or relationship persistence.
  • Entity-manager lifecycle problems — stale or shared managers across tests causing cross-test contamination.
  • Dependency resolution failures on Laravel upgrades, which surface as broken test infrastructure rather than application errors.
  • Abandonment risk materializing as an unpatchable incompatibility with a future framework version.

Ramp-up New engineers will need familiarity with both Analogue's data-mapper patterns and the pre-Laravel-8 string-based factory DSL — a combination that is increasingly rare. Expect onboarding friction and a shrinking hiring pool. Mitigate by documenting the bridge's behavior and keeping the affected surface area small; the smaller the number of factories that depend on it, the cheaper the eventual replacement.

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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource