Download the PHP package green-elephpant/code-bench-laravel without Composer
On this page you can find all versions of the php package green-elephpant/code-bench-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download green-elephpant/code-bench-laravel
More information about green-elephpant/code-bench-laravel
Files in green-elephpant/code-bench-laravel
Package code-bench-laravel
Short Description A package to conveniently use CodeBench in your Laravel project
License GPL-3.0-or-later
Informations about the package code-bench-laravel
Green ElePHPant - CodeBench Laravel
The Green ElePHPant wants to help you to reduce the carbon emissions of your software.
One way of doing so is to optimize the performance. Less CPU, RAM and Storage means reduced energy consumption, fewer carbon emissions, and less hardware to be produced. And, last but not least, the users of your software will benefit from a faster application.
GreenElephpant\CodeBenchLarvel is a tiny package to conveniently include CodeBench into your Laravel project.
Key concept
GreenElephpant\CodeBench is a simple helper to compare the performance of code blocks.
This package configures GreenElephpant\CodeBench to directly use Log::debug().
It provides helper functions like codebench_start() and codebench_stop() to measure the time and memory taken by a code block.
Installation
composer require green-elephpant/code-bench-laravel --dev
Note: we use require-dev here, since GreenElephpant\CodeBench should not be used in production code.
Usage
Basic usage
codebench() is a helper function to conveniently call the GreenElephpant\CodeBench\CodeBench class.
You can use it to compare the performance of two callbacks:
Please see the CodeBench documentation on more information.
The results will be logged using Laravel's Log::debug() by default. See Set Logger callable for more information.
Measure the performance of a code block
You can use the codebench_start() and codebench_stop() functions to measure the performance of a code block.
Also here, the results will be logged using Laravel's Log::debug() by default.
All versions of code-bench-laravel with dependencies
green-elephpant/code-bench Version ^v1.0.0
illuminate/support Version ^10.0|^11.0|^12.0