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

Eris Laravel Package

giorgiosironi/eris

Eris brings QuickCheck-style property-based testing to PHP and PHPUnit. Define properties, generate many random inputs, and find minimal counterexamples automatically. Works with PHP 8.1–8.4 and PHPUnit 10–13.

View on GitHub
Deep Wiki
Context7

Eris is a porting of Quickcheck and property-based testing tools to the PHP and PHPUnit ecosystem.

Frequently asked questions about Eris
How do I install Eris for Laravel projects?
Run `composer require --dev giorgiosironi/eris` in your project root. No Laravel-specific configuration is needed—it works with PHPUnit 10–13 out of the box. Test it immediately with the included examples via `vendor/bin/phpunit vendor/giorgiosironi/eris/examples`.
Can Eris replace traditional unit tests in Laravel?
No, use it to augment—not replace—traditional tests. Eris excels at uncovering edge cases (e.g., validation rules, calculations) but lacks the precision of handwritten tests for critical logic. Pair it with PHPUnit assertions for a robust suite.
Does Eris work with Laravel’s Eloquent models?
Yes, but you’ll need custom generators. Extend `Generators::suchThat()` or create a helper like `Generators::eloquentModel(User::class)` to generate fake models. Example: `Generators::string()->suchThat(fn($s) => strlen($s) > 5)` for model attributes.
How do I debug failing property tests in Laravel?
Eris automatically shrinks inputs to the smallest failing case. Check the error message for the exact input (e.g., `$number is not less than 42`). Use `disableShrinking()` if shrinking obscures the issue, then manually inspect the generated data.
Will Eris slow down my Laravel test suite?
Minimal overhead. Benchmark with `ERIS_ORIGINAL_INPUT=1` to measure generation time. For CI, limit test runs to critical properties (e.g., validation logic) or use parallel test execution. Avoid overusing complex generators in large suites.
Does Eris support Laravel’s API testing (e.g., HTTP requests)?
Indirectly. Use Eris to generate test data (e.g., `Generators::json()` for API payloads) and combine with Laravel’s `Http::fake()` or `Testing::assertJson()`. Example: `forAll(Generators::json())->then(fn($data) => $this->post('/api/users', $data))`.
How do I handle non-deterministic operations (e.g., UUIDs, external APIs) in Eris tests?
Disable shrinking with `disableShrinking()` or mock dependencies. For UUIDs, use `Generators::uuid()` with a fixed seed (`ERIS_SEED=123`). For APIs, mock responses with Laravel’s `Http::fake()` before running Eris tests.
What’s the best way to integrate Eris into a Laravel CI pipeline?
Run property tests separately from unit tests to avoid flakiness. Use `ERIS_SEED` for reproducibility and gate critical properties (e.g., validation) to fail builds. Example GitHub Actions step: `php vendor/bin/phpunit --filter 'property*' --seed 42`.
Are there Laravel-specific generators in Eris?
Not built-in, but easy to create. For example, generate Carbon dates with `Generators::dateTime()->suchThat(fn($dt) => $dt > now())` or fake Eloquent models with `Generators::model(User::class)`. Contribute custom generators to the community repo for broader use.
How do I write my first Eris property test for Laravel?
Start with a simple property, like validating user input lengths. Example: `forAll(Generators::string()->suchThat(fn($s) => strlen($s) > 3))->then(fn($name) => $this->assertTrue(Validator::make(['name' => $name])->passes()));`. Use the [Eris example project](https://github.com/giorgiosironi/eris-example) as a template.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
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