Skip to content

Metallizzer/laravel-bench

Repository files navigation

Benchmark tool inside your Laravel app

Latest Version on Packagist Software License Total Downloads

The metallizzer/laravel-bench package provides tool to compare different functions inside your Laravel app.

Installation

You can install the package via composer:

composer require --dev metallizzer/laravel-bench

Next, you must publish the assets from this package.

php artisan vendor:publish --provider="Metallizzer\Bench\BenchServiceProvider" --tag="bench-assets"

Optionally, you can publish the config file of the package.

php artisan vendor:publish --provider="Metallizzer\Bench\BenchServiceProvider" --tag="config"

This is the content that will be published to config/bench.php

return [
    /*
     * The benchmark page will be available on this path.
     */
    'path' => '/bench',

    /*
     * By default this package will only run in local development.
     * Do not change this, unless you know what your are doing.
     */
    'enabled' => env('APP_ENV') === 'local',

    /*
     * The maximum execution time, in seconds. If set to zero, no time limit is imposed.
     */
    'max_execution_time' => 0,
];

Usage

By default this package will only run in a local environment.

Visit /bench in your local environment of your app to view the benchmark page.

You can also run benchmarks as artisan command

php artisan bench:run

Use with passing benchmark class name

php artisan bench:run --benchmark="Benchmark\Class"

To run all available benchmarks just issue

php artisan bench:run --all

To create a new command, use the bench:make Artisan command.

php artisan bench:make

This command will create a new benchmark class in the app/Benchmarks directory.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.