myaaghubi/debench

A small debug/benchmark helper for PHP

1.5 2024-05-11 12:53 UTC

This package is auto-updated.

Last update: 2024-05-15 16:33:21 UTC


README

Test Debench Debench Coverage Status Debench release (latest by date) Debench License

A small debug/benchmark helper for PHP

myaaghubi/debench-debench-minimal myaaghubi/debench-debench-fullsize

How to use

Use composer:

composer require myaaghubi/debench

Then have it like:

namespace DEBENCH;

require __DIR__ . '/vendor/autoload.php';

Debench::info('let\'s have the debench');

// call it from your index.php after autoload 
// then check the webpage with your browser
// $debench = new Debench(true, 'theme');
Debench::getInstance(true, 'theme');

Debench::info('let\'s use some memory');
$st = str_repeat("Debench!", 10000);

Debench::info('step one');
// step one
// $debench->newPoint("one");
Debench::point('one');

$st .= str_repeat("Debench!", 10000);

Debench::info('step two');
// step two
Debench::point("two");

For minimal mode:

// it is safe and secure to use
// $debench->setMinimalOnly(true);
Debench::minimalOnly(true);

For production mode

// it's better to do it on initializing
//$debench = new Debench(false);
Debench::getInstance(false);
// or
Debench::enable(false);

License

You are allowed to use this plugin under the terms of the MIT License.

Copyright (C) 2024 Mohammad Yaaghubi