Download the PHP package nikoutel/phpdebugr without Composer
On this page you can find all versions of the php package nikoutel/phpdebugr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phpdebugr
PHPDebugr
A debugging tool for inspecting variables.
A quick and effective debugging tool/solution if you do not have access to (or don't want to use) a single-stepping debugger like xdebug. Powerful 'var_dump' replacement with logging capabilities and console support.
Usage
Debugr::eDbg(mixed $var [, string $description [, string $writeOption]])
Debugr::eDbg
writes the value of $var
and the $description
text (optional) to the output, defined in config.php
, using the $writeOption
.
Possible options for the output are: Screen
, Log
, Console
, and None
.
(The predefined value is Screen
)\
Debugr::eDbgScreen(mixed $var [, string $description [, string $writeOption]])
Debugr::eDbgScreen
writes the value of $var
to the screen regardless of the default config.php
file entry.\
Debugr::eDbgLog(mixed $var [, string $description [, string $writeOption [, sting|null $logFile]])
Debugr::eDbgLog
writes the value of $var
to the log file defined in config.php
, set through Debugr::setLogfile()
or passed through the $logFile
parameter.\
Debugr::eDbgConsole(mixed $var [, string $description [, string $writeOption]])
Debugr::eDbgConsole
writes the value of $var
to the browsers console.\
Debugr::setLogFile(string $logFile)
Debugr::setLogFile
sets the log file, overwriting the config.php
file option.\
Parameters
var
The variable to inspect\
description (optional)
Text to be displayed before the variable value e.g. The value of $thisVar is:
\
writeOption (optional)
The way the output is written/formatted:
options:
e
orechoes
– forecho
-like output
v
orvarDump
– forvar_dump
-like output
r
orprintR
– forprint_r
-like output
x
orexport
– forvar_export
-like output
If you omit this, the defaults are used. For scalar types (integer, double, string) the default is echoes
and for composite types (array, object, resource, boolean, null, unknown type) the default is varDump
. The defaults can be changed in the config.php
file.
(I know boolean is technically scalar and Null is, well, Null, but they are fitting better in the composite group)
Logging
Output can be logged to a file by specifying Log
as output in config.php
or by calling Debugr::eDbgLog()
directly.
The log file used can be defined as follows:
options:
-
Configuration option in
config.php
\ The default option. Predefined asoutput.log
. -
Through
Debugr::setLogfile()
\ Takes precedence over theconfig.php
option. - As 4th parameter of
Debugr::eDbgLog()
\ Has the highest priority. Is only set for this call.
(See example below)
Notes
If None
is used as the default output, Debugr::eDbg
will not produce any output. This is not true for eDbgScreen
, eDbgLog
, eDbgConsole
.
You can disable all by setting: disable:true
in config.php
. This is some sort of kill switch.
Install
Composer or no composer? That is the question!
composer:
no composer:
Just dump the files in you project and use as shown below.
How to use
Use eDbg
to output the variable values to the default output. On a developer server you can choose Screen
. If you have to use it on a production server use Log
and all Debugr::eDbg
calls will now write to the log file instead of the screen.
On some occasions e.g. when outputting a variable on screen breaks the site layout you can use eDbgConsole
to use the browser console regardless of the default output. In the same way you can use eDbgScreen
, eDbgLog
, according to the situation and your needs.
The value is formatted according to the variables type or the writeOption
given.
Requirements
- PHP 5.3 (min)
- (optional) The "Multibyte String" php extension (mbstring) - Allows multibyte characters to be used in log filenames
Examples
42
the value of pi is: 3.1415926530119
string(15) "Guru Meditation"
>Shall we play a game?: Array ( [0] => black jack [1] => gin rummy [2] => hearts [3] => bridge [4] => checkers [5] => chess [6] => global thermonuclear war )
will produce a log file entry:
will produce a console output:
License
This software is licensed under the MPL-2.0: