Download the PHP package alexandrebulete/laravel-benchmark without Composer

On this page you can find all versions of the php package alexandrebulete/laravel-benchmark. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-benchmark

Laravel Benchmark

A comprehensive benchmark system for Laravel applications. Safely test performance with isolated database, automatic cleanup, production protection, dynamic command generation, and intelligent optimization suggestions.

Latest Stable Version License

Features

Requirements

Installation

Then run the installation command:

Quick Start

1. Create a benchmark with a command code

2. Define CLI options in your benchmark

3. Run your benchmark

πŸ”„ Multiple Iterations - Stable & Reliable Results

By default, benchmarks run 5 iterations to provide statistically stable results. This eliminates variance from garbage collection, CPU cache, and other system factors.

Why Multiple Iterations?

A single benchmark run can be misleading due to:

Running multiple iterations and using the median provides much more reliable results.

Sample Output

Controlling Iterations

Warmup Runs

Warmup runs execute the benchmark but discard results - useful for:

Statistics Provided

Metric Description
Average Mean of all runs
Median Middle value (used for baselines)
Min / Max Range of results
Std Deviation Variance measure (Β±value and %)
P95 / P99 95th/99th percentile
Stability Assessment based on variance

Stability Grades:

Configuration

In config/benchmark.php:

High Variance Warning

When results are unstable, you'll see a warning:

This helps you know when your benchmark environment may be affecting results.

🧠 Advisor - Intelligent Query Analysis

The Advisor automatically analyzes all SQL queries during your benchmark and provides actionable optimization suggestions.

What it detects

Rule Description
N+1 Queries Same query pattern executed multiple times
Slow Queries Individual queries exceeding time threshold
Hotspots Code locations generating most DB activity
Duplicates Exact same queries executed multiple times

Sample Output

Performance Score

The Advisor calculates a Performance Score (0-100) based on:

Factor Impact
N+1 queries -8 to -15 per issue
Slow queries -10 to -20 per issue
High DB time (>70%) -10 to -15
Low query uniqueness -5 to -15
Bonuses +5 to +10 for clean code

Grades:

Smart Suggestions

The Advisor analyzes your SQL to provide specific eager loading suggestions:

Instead of generic advice, it detects the table and suggests the exact relationship name.

Disabling Advisor

Or globally via environment:

Configuring Thresholds

In config/benchmark.php:

Dynamic Commands

The killer feature! Define $code and $options in your benchmark class, and a CLI command is automatically generated.

This auto-creates:

List all available benchmarks and their codes:

Configuration

After installation, customize settings in config/benchmark.php:

Environment Variables

Docker Setup

Creating Benchmarks

Full Example

Running

πŸ“ˆ Baseline & Regression Detection

Track performance over time and detect regressions before they reach production.

Save a Baseline

Save current benchmark results as a reference point using --baseline:

Note: Baselines store the median execution time from all iterations - the most stable metric for comparisons.

Compare Against Baseline

Run benchmark and compare to saved baseline using --compare:

Regression Detection

When performance degrades:

CI/CD Integration

Export results as JSON and fail builds on critical regressions:

In your CI pipeline (GitHub Actions example):

List Saved Baselines

Configure Thresholds

In config/benchmark.php:

Available Commands

Command Description
benchmark:install Install the package (config, directories, Docker)
benchmark:list List all available benchmarks with codes
benchmark:run {name} Run a benchmark by class name
benchmark:{code} Run a benchmark with custom options (auto-generated)
benchmark:{code} --iterations=N Run N iterations (default: 5)
benchmark:{code} --warmup=N Discard first N runs as warmup
benchmark:{code} --baseline Run and save results as baseline
benchmark:{code} --compare Run and compare against baseline
benchmark:{code} --fail-on-regression Fail on critical regression (CI)
benchmark:baselines List all saved baselines
make:benchmark {name} Create a new benchmark class
make:benchmark {name} --code={code} Create a benchmark with dynamic command
make:benchmark-seeder {name} Create a new benchmark seeder

Security

Multiple safety measures:

  1. Environment Check: Commands refuse to run in production
  2. Config Flag: BENCHMARK_ENABLED must be true
  3. Separate Database: Uses isolated database connection
  4. Auto Cleanup: Database is wiped after each benchmark
  5. Docker Isolation: Benchmark database runs in separate container

License

MIT License - see LICENSE for details.

Author


All versions of laravel-benchmark with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^10.0 || ^11.0 || ^12.0
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0
illuminate/database Version ^10.0 || ^11.0 || ^12.0
illuminate/support Version ^10.0 || ^11.0 || ^12.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alexandrebulete/laravel-benchmark contains the following files

Loading the files please wait ...