Download the PHP package neunerlei/dbg without Composer

On this page you can find all versions of the php package neunerlei/dbg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dbg

DBG - Debug Helpers

This library is basically just a wrapper around Kint and PHP-Console combining them both into a powerful debugging tool.

Installation

Install this package using composer:

Environment detection

It is not recommended to use this library in production. However, if you have considered the risks and know what to do, this library tries to help you to run it in production as securely as possible.

To do so there are different mechanics you may use to determine when you want to enable the debugger or not. First of all, to enable the environment detection set the "environmentDetection" to true

  1. You can completely disable the functionality of this library by setting the "enabled" config option (see the " Configuration" section for further information) to false.
  2. You may define a environment variable to determine if the debugging is enabled or not. By default, the script will look for a env variable called "APP_ENV" which requires a value of "dev" to enable the debugging. You may configure the name of the variable, as well as the expected value. (PROJECT_ENV also works for legacy compatibility)
  3. By default, CLI commands are considered "save" and will allow execution of the debug methods. (See "cliIsDev" option)
  4. It is possible to only enable the debugging when a specific referrer is transmitted by your browser. To enable this take a look at the "debugReferrer" option. (See the referrer control extension for chrome.)

IP's I explicitly left out ip's for determining if the debugger should run or not, as I figure that method as quite error prone (especially when you work with a dynamic IP address). If you want to use this, you have to code that feature for yourself.

Configuration

It is possible to define multiple options for the debugger. The configuration is performed using the Neunerlei\Dbg\Dbg::config() function. Possible config options are:

Functions

dbg()

Takes any number of arguments and prints them to the screen, either formatted for html or for cli, depending on the current context.

Will render something like this in a browser:

and something like this in a CLI app:

dbge()

Works exactly the same way as dbg() but kills the script exit(0) after dumping the arguments to the screen.

trace()

Prints the current debug backtrace to the screen, either formatted for html or for cli, depending on the current context.

Will render something like this in a browser:

tracee()

Again, works exactly the same as trace, but kills the script after printing it.

logConsole()

This function is mend specifically for in-browser development only. It relies on PHP-Console and the chrome php console extension to render the given values to the javascript console without using html script tags or similar. It works also when performing redirects or throwing exceptions, as the data will be transferred over a http header.

This will output something like:

logFile()

Receives any number of arguments and will dump them into a plain log file. The logfile will be located (in order of priority):

logStream()

Receives any number of arguments and dumps them into a configured stream. By default the 'php://stdout' is used as output stream, which is the best solution if you work with docker. The output will always be a single line with all line-breaks removed to keep cloud logging apis nice and happy

You can change the stream path to match your needs:

Dbg::isEnabled()

This function returns true if the debug functions are currently operational (including the checks for the environment detection) and will return TRUE if so, or FALSE if not.

Dbg::config(string $key = "", $value = NULL)

This function is used to configure the debugger with the options seen in the "Configuration" section. If this function is called without arguments it will return the current list of config option. If it is called with a key but without value it will return the current value for the given key.

If you supply both key and value you will set the given config option.

Postcardware

You're free to use this package, but if it makes it to your production environment I highly appreciate you sending me a postcard from your hometown, mentioning which of our package(s) you are using.

You can find my address here.

Thank you :D


All versions of dbg with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 <8.4
kint-php/kint Version ^5.0.7
0.0.0/composer-include-files Version ^1.5
php-console/php-console Version ^3.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package neunerlei/dbg contains the following files

Loading the files please wait ....