From d7894b7dc1be108495c667f89119dfa91864573f Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Fri, 16 Oct 2020 10:13:45 +0700 Subject: [PATCH] Update README --- README.md | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/README.md b/README.md index 41826cd..1afb1b0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,119 @@ +[![Latest Stable Version](https://poser.pugx.org/nguyenanhung/my-debug/v)](https://packagist.org/packages/nguyenanhung/my-debug) +[![Latest Unstable Version](https://poser.pugx.org/nguyenanhung/my-debug/v/unstable)](https://packagist.org/packages/nguyenanhung/my-debug) +[![Total Downloads](https://poser.pugx.org/nguyenanhung/my-debug/downloads)](https://packagist.org/packages/nguyenanhung/my-debug) +[![License](https://poser.pugx.org/nguyenanhung/my-debug/license)](https://packagist.org/packages/nguyenanhung/my-debug) +[![Monthly Downloads](https://poser.pugx.org/nguyenanhung/my-debug/d/monthly)](https://packagist.org/packages/nguyenanhung/my-debug) +[![Daily Downloads](https://poser.pugx.org/nguyenanhung/my-debug/d/daily)](https://packagist.org/packages/nguyenanhung/my-debug) +[![composer.lock](https://poser.pugx.org/nguyenanhung/my-debug/composerlock)](https://packagist.org/packages/nguyenanhung/my-debug) + # My Debug +## Debug +```php + 'Nguyen An Hung', + 'email' => 'dev@nguyenanhung.com' +]; +// Call +$debug = new Debug(); +$debug->setDebugStatus(TRUE); +$debug->setGlobalLoggerLevel(NULL); +$debug->setLoggerPath($logPath); +$debug->setLoggerSubPath($logSubPath); +$debug->setLoggerFilename($logFilename); +$debug->__construct(); +echo "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; +echo "\n getVersion: " . $debug->getVersion() . "\n"; +echo "\n setDebugStatus: " . $debug->getDebugStatus() . "\n"; +echo "\n setLoggerPath: " . $debug->getLoggerPath() . "\n"; +echo "\n setLoggerSubPath: " . $debug->getLoggerSubPath() . "\n"; +echo "\n setLoggerFilename: " . $debug->getLoggerFilename() . "\n"; +echo "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; + +d($debug->debug($name, $msg . ' - DEBUG', $context)); +d($debug->info($name, $msg . ' - INFO', $context)); +d($debug->notice($name, $msg . ' - NOTICE', $context)); +d($debug->warning($name, $msg . ' - WARNING', $context)); +d($debug->error($name, $msg . ' - ERROR', $context)); +d($debug->critical($name, $msg . ' - CRITICAL', $context)); +d($debug->alert($name, $msg . ' - ALERT', $context)); +d($debug->emergency($name, $msg . ' - EMERGENCY', $context)); +``` + +## Benchmark +```php +mark('code_start'); +$mathFunctions = ["abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin", "tan", "pi", "is_finite", "is_nan", + "sqrt"]; +$count = 9999; +for ($i = 0; $i < $count; $i++) { + foreach ($mathFunctions as $key => $function) { + call_user_func_array($function, [$i]); + echo ($key + 1) . " -> " . $function . "\n"; + } +} +$benchmark->mark('code_end'); + +d($benchmark->getVersion()); +d($benchmark->elapsed_time('code_start', 'code_end')); +d($benchmark->memory_usage()); +/***************************** SIMPLE BENCHMARKING BY CI *****************************/ +``` + +## Manage File +```php +setExclude(['*.zip']); +$file->setInclude(['*.log']); +d($file->getVersion()); + +$path = testLogPath(); + +d($file->scanAndZip($path, 3)); +``` + +## Utils +```php +getVersion()); +d($utils::slugify($str)); +d($utils::convert_vi_to_en($str)); +``` + ## Support If any question & request, please contact following information