Skip to content

Class Phalcon\Debug

Source on GitHub

| Namespace | Phalcon | | Uses | ErrorException, Phalcon\Helper\Arr, Phalcon\Version, Phalcon\Tag, ReflectionClass, ReflectionFunction |

Provides debug capabilities to Phalcon applications

Properties

/**
 * @var array
    */
protected blacklist;

//
protected data;

/**
 * @var bool
 */
protected hideDocumentRoot = false;

/**
 * @var bool
 */
protected static isActive;

/**
 * @var bool
 */
protected showBackTrace = true;

/**
 * @var bool
 */
protected showFileFragment = false;

/**
 * @var bool
 */
protected showFiles = true;

/**
 * @var string
    */
protected uri = https://assets.phalcon.io/debug/4.0.x/;

Methods

public function clearVars(): Debug;
Clears are variables added previously

public function debugVar( mixed $varz, string $key = null ): Debug;
Adds a variable to the debug output

public function getCssSources(): string;
Returns the CSS sources

public function getJsSources(): string;
Returns the JavaScript sources

public function getVersion(): string;
Generates a link to the current version documentation

public function halt(): void;
Halts the request showing a backtrace

public function listen( bool $exceptions = bool, bool $lowSeverity = bool ): Debug;
Listen for uncaught exceptions and unsilent notices or warnings

public function listenExceptions(): Debug;
Listen for uncaught exceptions

public function listenLowSeverity(): Debug;
Listen for unsilent notices or warnings

public function onUncaughtException( \Throwable $exception ): bool;
Handles uncaught exceptions

public function onUncaughtLowSeverity( mixed $severity, mixed $message, mixed $file, mixed $line, mixed $context ): void;
Throws an exception when a notice or warning is raised

public function renderHtml( \Throwable $exception ): string;

public function setBlacklist( array $blacklist ): Debug;
Sets if files the exception's backtrace must be showed

public function setShowBackTrace( bool $showBackTrace ): Debug;
Sets if files the exception's backtrace must be showed

public function setShowFileFragment( bool $showFileFragment ): Debug;
Sets if files must be completely opened and showed in the output or just the fragment related to the exception

public function setShowFiles( bool $showFiles ): Debug;
Set if files part of the backtrace must be shown in the output

public function setUri( string $uri ): Debug;
Change the base URI for static resources

protected function escapeString( mixed $value ): string;
Escapes a string with htmlentities

protected function getArrayDump( array $argument, mixed $n = int ): string | null;
Produces a recursive representation of an array

protected function getVarDump( mixed $variable ): string;
Produces an string representation of a variable

final protected function showTraceItem( int $n, array $trace ): string;
Shows a backtrace item

Class Phalcon\Debug\Dump

Source on GitHub

| Namespace | Phalcon\Debug | | Uses | Phalcon\Di, Phalcon\Helper\Json, Reflection, ReflectionClass, ReflectionProperty, stdClass |

Dumps information about a variable(s)

$foo = 123;

echo (new \Phalcon\Debug\Dump())->variable($foo, "foo");
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();

echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);

Properties

/**
 * @var bool
 */
protected detailed = false;

/**
 * @var array
 */
protected methods;

/**
 * @var array
 */
protected styles;

Methods

public function __construct( array $styles = [], bool $detailed = bool );
Phalcon\Debug\Dump constructor

public function all(): string;
Alias of variables() method

public function getDetailed(): bool

public function one( mixed $variable, string $name = null ): string;
Alias of variable() method

public function setDetailed( bool $detailed )

public function setStyles( array $styles = [] ): array;
Set styles for vars type

public function toJson( mixed $variable ): string;
Returns an JSON string of information about a single variable.

$foo = [
    "key" => "value",
];

echo (new \Phalcon\Debug\Dump())->toJson($foo);

$foo = new stdClass();
$foo->bar = "buz";

echo (new \Phalcon\Debug\Dump())->toJson($foo);

public function variable( mixed $variable, string $name = null ): string;
Returns an HTML string of information about a single variable.

echo (new \Phalcon\Debug\Dump())->variable($foo, "foo");

public function variables(): string;
Returns an HTML string of debugging information about any number of variables, each wrapped in a "pre" tag.

$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();

echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);

protected function getStyle( string $type ): string;
Get style for type

protected function output( mixed $variable, string $name = null, int $tab = int ): string;
Prepare an HTML string of information about a single variable.

Class Phalcon\Debug\Exception

Source on GitHub

| Namespace | Phalcon\Debug | | Extends | \Phalcon\Exception |

Exceptions thrown in Phalcon\Debug will use this class