Effortless Laravel Performance Testing with Volt Test PHP SDK
When your Laravel app hits real traffic, will it fly⦠or will it fall over?
Most load-testing tools make you jump through hoops β learn a new scripting language, spin up external services, or fight with configs that feel like they belong to another ecosystem.
Thatβs why I built the Laravel Performance Testing package:
a native, PHP-first way to run load and stress tests right inside your Laravel project β powered by the Volt Test PHP SDK.
You write your tests in plain PHP, keep them version-controlled with your codebase, and run them with a single Artisan command. No context-switching. No external scripts. Just Laravel, PHP, and the performance insights you need before your users find the bottlenecks.
Why I Created This Packageβ
About a month ago, I released this package to make performance testing in Laravel:
- Easier β no external scripts or frameworks to learn.
- Native β tests live inside your Laravel project.
- Flexible β from simple single-URL load tests to complex multi-step scenarios.
β¨ Featuresβ
- Laravel-friendly integration β Works seamlessly with routes, middleware, and config.
- Artisan commands β Generate and run tests directly from the CLI.
- Automatic route discovery β Quickly build test scenarios from your existing routes.
- Variable extraction β Reuse cookies, headers, JSON fields, and HTML values between steps.
- Data-driven testing β Feed test data from CSV files for realistic simulations.
- Detailed metrics β Success rate, RPS, average latency, P95 latency, and more.
- Report storage β Save test results for later analysis.
π Installationβ
composer require volt-test/laravel-performance-testing
Publish the configuration file:
php artisan vendor:publish --tag=volttest-config
This creates config/volttest.php
where you can tweak settings like default virtual users, duration, and report paths.
β‘ Quick Startβ
You can run a quick performance test without writing any code:
php artisan volttest:run https://example.com/api/login --users=100 --method=POST --body='{"email":"test@example.com","password":"secret"}'
Or, you can create a reusable test class:
php artisan volttest:make ExampleTest
This generates app/VoltTests/ExampleTest.php
:
namespace App\VoltTests;
use VoltTest\Laravel\Contracts\VoltTestCase;
use VoltTest\Laravel\VoltTestManager;
class ExampleTest implements VoltTestCase
{
public function define(VoltTestManager $manager): void
{
$manager->scenario('ExampleTest')
->step('Visit Home Page')
->get('https://example.com')
->validateStatus('success', 200);
}
}
Run it with:
php artisan volttest:run ExampleTest --users=50 --duration=30
π― Route-Based Test Generationβ
Skip manual coding by letting the package generate tests from your Laravel routes.
# Include all routes
php artisan volttest:make ApiTest --routes
# Filter by pattern
php artisan volttest:make ApiTest --routes --filter="api/*"
# Only GET routes
php artisan volttest:make ApiTest --routes --method=GET
# Only authenticated routes
php artisan volttest:make ApiTest --routes --auth
# Interactive selection
php artisan volttest:make ApiTest --routes --select
π Data-Driven Testingβ
Simulate realistic usage with CSV files:
users.csv
name,email,password
John Doe,user1@example.com,password123
Jane Smith,user2@example.com,password456
Test definition:
$manager->scenario('RegisterTest')
->dataSource('users.csv')
->step('Register User')
->post('/register', [
'name' => '${name}',
'email' => '${email}',
'password' => '${password}',
]);
π Extract & Reuse Valuesβ
You can capture values from responses and reuse them in later steps.
CSRF token from HTML
$scenario->step('Get Login Page')
->get('/login')
->extractCsrfToken('csrf_token');
$scenario->step('Submit Login')
->post('/login', [
'_token' => '${csrf_token}',
'email' => 'user@example.com',
'password' => 'secret',
]);
JSON field
$scenario->step('Get User')
->get('/api/user')
->extractJson('user_id', 'data.id');
Header
$scenario->step('Get Token')
->get('/auth')
->extractHeader('Authorization', 'Bearer ${token}');
π Analyzing Resultsβ
After running a test, youβll see metrics such as:
- β Success rate
- β‘ Requests per second (RPS)
- β± Average & P95 latency
- β Duration
- β Errors
If save_reports
is enabled, youβll find detailed reports in:
storage/volttest/reports
π Conclusionβ
With Laravel Performance Testing powered by the Volt Test PHP SDK, you can:
- Keep performance tests right inside your Laravel project.
- Run them with one simple Artisan command.
- Get detailed, actionable performance metrics before your users ever notice a slowdown.
No separate scripting language. No complex setup. Just Laravel, PHP, and the truth about your appβs performance.
π Docs: Laravel Performance Testing on GitHub
π¦ Volt Test PHP SDK: php.volt-test.com
Integrate Volt-Test into your CI pipeline to catch performance regressions before they hit production.
Be first to run massive, distributed tests in the cloud. Limited seats.