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

Generate PHP class instances populated with dummy data

Frequently asked questions about Dummy
Can I use directorytree/dummy to replace Laravel’s built-in Factory class for test data?
Yes, the package integrates with Laravel’s `HasFactory` trait (v1.3.0+) and mimics Eloquent factory syntax, making it a drop-in alternative. It’s lighter than Laravel’s native Factory but lacks some built-in Laravel-specific features like model events or observers. For pure test data generation, it’s a solid choice.
How do I install directorytree/dummy in a Laravel project?
Run `composer require directorytree/dummy` in your project root. No Laravel service provider or Artisan command is required—just use the factory classes directly. For Laravel models, add the `HasFactory` trait to leverage Laravel’s factory conventions.
Does directorytree/dummy work with Laravel 13, or should I stick to Laravel’s native Factory?
The package explicitly supports Laravel 11, 12, and 13 (v1.2.0–v1.4.0). If you’re on Laravel 13, it’s fully compatible, but weigh whether you need Laravel-specific features like model events. For generic test data, this package is a lightweight alternative.
Can I generate nested relationships (e.g., a User with multiple Posts) with this package?
Yes, the package supports nested factory definitions via method chaining (e.g., `Post::factory()->for(User::factory())`). Stateful factories (v1.3.0+) also allow conditional relationships, like `Post::factory()->stateAsPublished()->forAuthor()`.
Is directorytree/dummy compatible with PestPHP or PHPUnit for testing?
It works seamlessly with PestPHP (dev dependency included) and PHPUnit via Orchestra/Testbench. The syntax aligns with Laravel’s testing conventions, so you can use it in both frameworks without major adjustments. For PHPUnit-only projects, no extra setup is needed.
How does directorytree/dummy handle production data vs. test data?
This package is designed for test data only—it doesn’t include database migrations or production-safe seeding. For production, use Laravel migrations or seeders. The package’s focus is on generating consistent, disposable test fixtures.
What’s the difference between directorytree/dummy and fakerphp/faker?
While `fakerphp/faker` generates raw fake data (e.g., names, emails), this package builds on Faker to create full PHP class instances with relationships and states. It’s ideal for Laravel models, whereas Faker is more generic. Use Faker if you need standalone fake data.
Can I use directorytree/dummy in a non-Laravel PHP project?
Yes, the package is framework-agnostic (no Laravel core dependency since v1.1.0). However, Laravel-specific features like `HasFactory` or Arr helper optimizations won’t work. For non-Laravel use, treat it as a Faker wrapper for object generation.
How do I create a stateful factory (e.g., a User with admin privileges)?
Define states in your factory class using `state()` methods, like `stateAsAdmin()` or `stateAsGuest()`. Then call them during generation: `User::factory()->stateAsAdmin()`. Stateful factories (v1.3.0+) support conditional logic for complex test scenarios.
Are there performance concerns with directorytree/dummy vs. Laravel’s Factory?
The package is optimized for speed, especially with Arr helper improvements (v1.3.1+). For large-scale tests, it’s comparable to Laravel’s Factory but avoids some overhead like model event triggers. Benchmark in your CI pipeline to compare with your existing setup.
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata