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

Dummy Laravel Package

directorytree/dummy

directorytree/dummy is a Laravel/PHP package providing a lightweight dummy/test utility for generating placeholder data and fixtures. Useful for local development, demos, and automated tests where realistic sample content is needed quickly and consistently.

View on GitHub
Deep Wiki
Context7

directorytree/dummy is a lightweight Laravel/PHP package for generating and managing dummy data and placeholder structures during development. It helps you quickly scaffold realistic-looking content so you can prototype features, test UI states, and validate flows without relying on production data.

Built for a smooth developer experience, it’s ideal for seeding projects, demos, and automated tests where repeatable fixtures matter.

Features

  • Generate dummy records for rapid prototyping
  • Simple API for creating repeatable fixtures
  • Works well with testing and local environments
  • Helps populate seeders and demo datasets quickly
Frequently asked questions about Dummy
How do I install directorytree/dummy in a Laravel project?
Add the package via Composer: `composer require directorytree/dummy`. For Laravel testing, include `orchestra/testbench` in your `require-dev` section. The package works with Laravel 11/12 and standalone PHP projects (post-v1.1.0).
Can I use this package for Laravel 10 or older versions?
No, the package explicitly supports Laravel 11/12 (v1.2.0+). For older versions, check the v1.1.x branch, but compatibility isn’t guaranteed. Consider alternatives like `fakerphp/faker` if you need broader Laravel version support.
What’s the difference between this and Laravel’s built-in Factory?
This package offers a simpler API for generating dummy data and supports stateful factories (via `HasFactory` trait in v1.3.0+), making it easier to create complex test scenarios. Laravel’s Factory is more tightly integrated but heavier for basic use cases.
How do I generate dummy records for a model like `User`?
Use the factory method: `Dummy::factory(User::class)->create()`. For stateful data (e.g., admin users), chain `->state(['role' => 'admin'])` if using `HasFactory`. The package mimics Laravel’s factory pattern but with a lighter footprint.
Does this package work with PestPHP or only PHPUnit?
It works with both, but PestPHP support is included as a dev dependency. For PHPUnit, you’ll need `orchestra/testbench` if running Laravel-specific tests. The package itself is framework-agnostic for core functionality.
Can I use this for production data seeding?
No, this package is designed for development, testing, and local demos. It generates placeholder data, not production-ready fixtures. For seeding, use Laravel’s native `DatabaseSeeder` or tools like `laravel/model-factory` with caution.
What if I need to generate nested or related dummy data (e.g., users with posts)?
Use the `has()` method for relationships: `Dummy::factory(User::class)->has(Post::factory()->count(3))->create()`. This mirrors Laravel’s factory behavior but with the package’s lightweight API. Test with `orchestra/testbench` for assertions.
Is there a performance impact when generating large datasets?
The package is optimized for speed, but dynamic factories (stateful data) may add minor overhead. Benchmark against `fakerphp/faker` or Laravel’s Factory for your use case. For bulk operations, consider batching or caching generated data.
How do I customize the dummy data format (e.g., fake names, addresses)?
Extend the package’s `Dummy` class or use Laravel’s `Faker` integration if available. For custom formats, override the default providers or chain methods like `->withName()` if the package supports it. Check the README for provider examples.
What are the alternatives to directorytree/dummy for Laravel?
For Laravel-native solutions, use `laravel/model-factory` (heavier but feature-rich) or Laravel’s built-in Factory. For generic PHP, `fakerphp/faker` is more flexible. If you need mock objects, consider `mockery/mockery`. Evaluate based on your need for stateful factories or simplicity.
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
milesj/emojibase
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