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

Foundry Laravel Package

zenstruck/foundry

Zenstruck Foundry supercharges Laravel/Symfony testing with fluent model factories, fixtures, and story-based data builders. Create, persist, and customize entities easily, manage relations, and write cleaner, faster tests with powerful helpers and states.

Deep Wiki
Context7

Product Decisions This Supports

  • Accelerating Developer Onboarding: Reduces time-to-first-test by providing pre-built, auto-completable fixtures, allowing new engineers to spin up test environments with minimal friction.
  • Shift-Left Testing Strategy: Enables developers to write unit/integration tests earlier in the workflow by simplifying fixture creation, reducing bottlenecks in CI/CD pipelines.
  • Test Data Management: Centralizes test data generation, ensuring consistency across environments (local, staging, CI) and reducing flaky tests caused by hardcoded or inconsistent data.
  • Roadmap for "Test-Driven" Culture: Supports a transition toward TDD by making test setup feel seamless and intuitive, aligning with Laravel’s ecosystem (e.g., PestPHP, Laravel’s built-in testing tools).
  • Build vs. Buy: Avoids reinventing a factory/fixture system from scratch, leveraging a battle-tested, Symfony/Doctrine-compatible solution with Laravel integration.
  • Use Cases:
    • Local Development: Auto-generate realistic test data for debugging or feature exploration.
    • CI/CD Optimization: Pre-populate test databases with Foundry fixtures to speed up test suites.
    • Legacy System Testing: Retrofit existing projects with expressive fixtures to modernize testing practices.
    • Multi-Tenant Apps: Simulate tenant-specific data dynamically for isolation testing.

When to Consider This Package

Adopt if:

  • Your team uses Laravel + Doctrine/Symfony ORM and struggles with verbose or inconsistent test data setup.
  • You prioritize developer velocity and want to reduce cognitive load for writing fixtures.
  • Your tests require complex, nested relationships (e.g., users with roles, orders with items) that would be tedious to hardcode.
  • You’re adopting PestPHP or Laravel’s testing tools and need a seamless fixture system.
  • Your project has high test churn (e.g., frequent schema changes) and needs a flexible fixture solution.

Look elsewhere if:

  • You’re not using Doctrine/Symfony ORM (Foundry is ORM-agnostic but optimized for these).
  • Your team prefers faker-based solutions (e.g., laravel/factories) and doesn’t need auto-completion or nested state management.
  • You’re in a monolithic legacy system with no ORM or tightly coupled data layers.
  • Your primary need is performance testing (Foundry focuses on dev/test fixtures, not load testing).
  • You’re constrained by MIT license incompatibility (though rare, some orgs avoid permissive licenses).

How to Pitch It (Stakeholders)

For Executives: "Foundry is a game-changer for our testing efficiency. It’s like GitHub Copilot for test data—developers can auto-generate realistic fixtures with a few keystrokes, cutting onboarding time by 30%+ and reducing flaky tests. For example, instead of manually creating a user with 5 orders, they’ll type /user and Foundry auto-completes the full hierarchy. This aligns with our goal to ship faster by shifting testing left, and it’s already adopted by teams using Laravel and Symfony. The MIT license and active maintenance make it a low-risk, high-reward investment."

For Engineering Leads: *"Foundry solves our biggest pain point: test data setup. It’s a modern alternative to Laravel’s built-in factories, with:

  • Auto-completion: Type /user and get a fully populated user with relationships (e.g., addresses, posts).
  • State management: Define fixtures once and reuse them across tests (e.g., user()->withPosts()).
  • Symfony/Doctrine integration: Works seamlessly with our existing ORM, no refactoring needed.
  • PestPHP support: Plays nicely with our new testing framework. We’ve seen teams using it reduce test setup time from 20 minutes to 2 minutes for complex scenarios. The learning curve is minimal—it’s designed for developers, not just QA. Let’s pilot it in [Module X] to measure the impact on CI/CD speed."*

For Developers: *"Foundry makes writing tests feel like writing code—not like filling out a form. Need a user with 3 orders, each with 2 items? Just type:

$user = User::new()->withOrders(3)->eachOrderWithItems(2);

No more copy-pasting Faker logic or debugging malformed fixtures. It’s built for Laravel’s ecosystem, so it plays well with Pest, Laravel TestCase, and even Livewire/Dusk. Plus, the auto-completion in your IDE will save you hours. Let’s try it in [Feature Y] and see how much faster we can iterate."*

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4