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 Stress

Laravel Stress Laravel Package

laramint/laravel-stress

Fire-and-forget HTTP stress testing for Laravel. Runs Guzzle request pools in a background subprocess to avoid deadlocks with php artisan serve, with an in-process fallback for multi-threaded servers. Returns JSON stats (throughput, percentiles, errors).

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Laravel Stress
How do I run stress tests without blocking php artisan serve in Laravel?
Use the `StressTestRunner` class with `startBackground()`. It spawns Guzzle requests in a subprocess, avoiding deadlocks with Laravel’s single-threaded dev server. Poll results via a temporary JSON file using the generated job ID.
Does laravel-stress work with multi-threaded servers like Nginx or Apache?
Yes. The package includes an in-process fallback mode (`run()` method) that works seamlessly with multi-threaded servers, ensuring compatibility across dev and production environments.
What Laravel versions does this package support?
Check the package’s `composer.json` for exact version requirements, but it’s designed for modern Laravel (8.x+) and leverages Guzzle, which is widely supported. Ensure your Laravel version aligns with Guzzle’s compatibility.
Can I integrate stress testing into my CI/CD pipeline?
Yes, but results must be manually validated since the package doesn’t include built-in assertions. Use PHPUnit/Pest hooks to trigger tests and parse JSON output for custom validation logic in your pipeline.
How do I handle sensitive headers (e.g., API keys) in stress tests?
Pass sensitive headers via environment variables or encrypted storage (e.g., Laravel’s `config/stress.php`). Avoid hardcoding credentials in test configurations to prevent leaks.
What if I need higher concurrency than Guzzle’s default (5)?
The package uses Guzzle’s concurrency limits, which may not scale for high-load scenarios. For advanced needs, consider replacing subprocesses with Laravel queues or a custom solution like `reactphp` for distributed testing.
How do I access stress test results programmatically?
For background jobs, poll the temporary JSON file using the job ID (e.g., `sys_get_temp_dir() . '/lb_st_res_' . $jobId . '.json'`). For synchronous runs, the `run()` method returns a structured JSON object with metrics like throughput, error rates, and timing percentiles.
Are there alternatives to laravel-stress for Laravel load testing?
For CI/CD-focused testing, consider `laravel-shift/load-testing` or `spatie/laravel-load-testing`. For production-grade tools, use dedicated solutions like Locust or k6, though they require separate infrastructure.
How do I clean up temporary result files after tests?
The package doesn’t auto-delete files, so manually remove them after processing (e.g., `unlink($resultFile)`). For shared environments, configure a custom temp directory (e.g., `storage/app/stress-results`) to avoid permission issues.
Can I monitor stress test results in real-time (e.g., Slack alerts)?
No, the package doesn’t include alerting. Extend it by parsing JSON results in a Laravel event listener or queue job, then trigger notifications via services like Slack or Datadog using Laravel’s notification system.
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.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit