1. Go to this page and download the library: Download stekel/laravel-bench library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stekel / laravel-bench example snippets
// App\Benchmarks\Homepage.php
namespace stekel\LaravelBench\Assessments;
use stekel\LaravelBench\Assessment;
class Homepage extends Assessment
{
/**
* Path to execute the test against
* - If null, create route via slug for execution
*/
public ?string $path = '/';
/**
* Number of requests to send at a time
*/
public int $concurrency = 10;
/**
* Number of total requests to send
*/
public int $requests = 100;
/**
* Slug to use for reference
*/
public string $slug = 'homepage';
}
// App\Benchmarks\LargeQuery.php
namespace App\Benchmarks;
use stekel\LaravelBench\Assessment;
class LargeQuery extends Assessment
{
public $path = null;
public $concurrency = 10;
public $requests = 100;
public $slug = 'large-query';
public function route() {
User::limit(1000)->get();
}
}
bash
php artisan stekel:bench {test}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.