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 Doctrine Factory Laravel Package

stemble/laravel-doctrine-factory

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Unified Testing Framework: Adopting this package allows teams to standardize factory-based testing across both Eloquent and Doctrine entities, reducing context-switching and developer onboarding time. This aligns with roadmap goals for test automation and developer experience.
  • Build vs. Buy: Avoids reinventing a factory system for Doctrine while leveraging Laravel’s mature, well-documented Eloquent factory ecosystem. Reduces technical debt compared to maintaining a custom solution.
  • Use Cases:
    • Test-Driven Development (TDD): Enables seamless creation of Doctrine entities in unit/integration tests, mirroring Eloquent’s intuitive syntax (e.g., UserFactory::new()->hasPosts(3)).
    • Seeders & Data Migration: Simplifies bulk data generation for Doctrine entities during application setup or migrations.
    • API Contract Testing: Generates consistent test data for validating Doctrine-based API responses.
    • Legacy System Modernization: Gradually migrates from Eloquent to Doctrine while retaining familiar factory patterns.
  • Developer Productivity: Reduces friction for backend engineers accustomed to Laravel’s Eloquent factories, accelerating feature development and reducing bugs in test data setup.

When to Consider This Package

  • Adopt When:
    • Your team uses Laravel + Doctrine and wants to leverage Eloquent’s factory API for Doctrine entities.
    • You prioritize developer familiarity and consistency in testing patterns across Eloquent/Doctrine.
    • Your project requires modern factory features (states, relationships, sequences, callbacks) that the official laravel-doctrine/orm factory lacks.
    • You’re building a greenfield project or migrating to Doctrine but want to avoid a steep learning curve for test data setup.
  • Look Elsewhere If:
    • You’re fully committed to Eloquent and don’t need Doctrine integration.
    • Your team prefers type safety over Laravel’s dynamic factory syntax (e.g., PHPStan/Nikita integration may be limited).
    • You need advanced Doctrine-specific features (e.g., DQL queries in factories) not covered by this package.
    • Your project has strict dependency constraints (e.g., avoiding MIT-licensed packages or Laravel-specific tools).
    • You’re using Doctrine outside Laravel (this package is Laravel-centric).

How to Pitch It (Stakeholders)

For Executives:

"This package lets our backend team use Laravel’s battle-tested factory system for Doctrine entities, cutting test setup time by 30% and reducing onboarding friction for new hires. By standardizing how we generate test data—whether for Eloquent or Doctrine—we’ll ship features faster and catch bugs earlier. It’s a low-risk, high-reward move that aligns with our tech stack and developer productivity goals."

Key Outcomes:

  • Faster test-driven development.
  • Reduced technical debt from inconsistent factory patterns.
  • Easier hiring/retention for Laravel/Doctrine engineers.

For Engineering Leaders:

"This solves a pain point for our Doctrine users: they’ve been stuck with a frozen, second-class factory API from laravel-doctrine/orm. This package brings modern Eloquent factory features (states, relationships, sequences) to Doctrine, so our team can write tests like UserFactory::new()->state('admin')->hasPosts(2)—no more reinventing the wheel. It’s a drop-in replacement for anyone familiar with Laravel factories, and the MIT license means no legal blockers."

Engineering Benefits:

  • Consistency: One factory API for all entities (Eloquent/Doctrine).
  • Productivity: Leverage Laravel’s well-documented factory ecosystem.
  • Maintenance: No need to maintain a custom factory system.
  • Future-Proof: Aligns with Laravel’s evolving factory features.

For Developers:

"Tired of writing clunky Doctrine factory closures? This package lets you use Eloquent’s clean, expressive factory syntax for Doctrine entities. Need a user with 3 posts? Just do UserFactory::new()->hasPosts(3). Supports states (->state('admin')), sequences, and callbacks—everything you love about Eloquent factories, now for Doctrine. Zero learning curve if you’ve used Laravel’s factories before."

Developer Perks:

  • Familiar API: Uses Laravel’s factory methods you already know.
  • Relationship Helpers: has(), for(), hasPosts()—just like Eloquent.
  • States & Sequences: Reuse test data with ->state('admin') or generate sequential IDs.
  • Callbacks: afterMaking/afterCreating for post-processing.
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui