VarDumper Component
The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump()
function that you can use instead of var_dump
.
The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump()
function that you can use instead of var_dump
.
Var-dumper requires the iconv extension. I was using it on a freshly installed PHP instance and got the following fatal error:
Error: Call to undefined function Symfony\Component\VarDumper\Dumper\iconv_strlen() in Symfony\Component\VarDumper\Dumper\CliDumper->dumpString() (line 172 of vendor/symfony/var-dumper/Dumper/CliDumper.php).
We may want to see the output based on the conditions, so dd_if
will make our job easier.
$value = 1;
$data = [1, 2, 3, 4, 5];
dd_if(in_array($value, $data));
| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no
Added support of FFI:
$ffi = \FFI::cdef(<<<'CPP'
typedef struct { int x; int y; } Point;
typedef struct Example {
uint8_t array[32];
long longVal;
__extension__ union {
__extension__ struct { short shortVal; };
struct { Point point; float e; };
};
bool boolValue;
int (*func)(struct __sub *h);
} Example;
CPP);
$struct = $ffi->new('Example');
$struct->func = (static fn (object $ptr) => 42);
dump($struct);
Before
FFI\CData {#2}
After
FFI\CData<struct Example> size 64 align 8 {#2
+array: FFI\CData<uint8_t[32]> size 32 align 1 {#18}
+int32_t longVal: 0
+int16_t shortVal: 0
+point: FFI\CData<struct <anonymous>> size 8 align 4 {#17
+int32_t x: 0
+int32_t y: 0
}
+float e: 0.0
+bool boolValue: false
+func: [cdecl] callable(struct __sub*): int32_t {#20
returnType: FFI\CType<int32_t> size 4 align 4 {#25}
}
}
Adds ddc helper function as an exhaustive version of dump.
ddc stands for: Die Dump Count
There is a lot of time when the first call to the dd() is not what we want. on the other hand, dump() does not have a break and prints out much more than we want.
This is something in between dd and dump. For example, we want to see what parameters are passed to a method, but that method is called multiple times and the first couple of calls does not matter to us. Or any other debug a process which involves a loop
<?php
$i = 0;
while (true) {
$i++;
ddc(4, $i); // dumps 1, 2, 3, 4 then dies
ddc([0, 4], $i); // same as ddc(4, $i);
}
$i = 0;
while (true) {
$i++;
ddc([2,4], $i); // dumps 3, 4 (skips 1, 2)
}
We can see the objects with namespace that help us to navigate to the file easily.
Before: These are diffrent Collection
class
Now: we can see the diffrent
Possibility to replace existing css style for HTMLDumper without replacing the whole css class definition like changing background-color, font or word-break, etc
e.g.
$dumper->changeStyle('default', 'word-break', 'break-word')
would change css style of word-break
to break-word
from break-all
Calling the dump()
method for the first time is not producing any output. That's because, in the latest change, the first call to the dump
method is not calling the $handler
at all. It's just setting the $handler
.
In this PR, I've tried to fix this issue.
If the ClassStub
needs to work with a class closure, it will throw a FatalErrorException
. I got this:
FatalErrorExceptionError: __debuginfo() must return an array
--
in ClassStub.php line 56
at ReflectionMethod->__construct('\'eZ\\\\Publish\\\\Core\\\\Base\\\\Container\\\\ApiLoader\\\\Storage\\\\ExternalStorageRegistryFactory\'', '\'eZ\\\\Publish\\\\Core\\\\Base\\\\Container\\\\ApiLoader\\\\Storage\\\\{closure}\'') in ClassStub.php line 56
at ClassStub->__construct('identifier' => '\'eZ\\\\Publish\\\\Core\\\\Base\\\\Container\\\\ApiLoader\\\\Storage\\\\ExternalStorageRegistryFactory->eZ\\\\Publish\\\\Core\\\\Base\\\\Container\\\\ApiLoader\\\\Storage\\\\{closure}\'', 'callable' => '???') in ExceptionCaster.php line 163
...
This bugfix handles this situation.
The return type used here will throw an error:
Fatal error: Uncaught TypeError: Return value of Symfony\Component\VarDumper\Dumper\ServerDumper::dump() must be an instance of Symfony\Component\VarDumper\Dumper\void, none returned
This PR simply removes it.
On some systems creating async TCP connection results in "failed to open stream: Resource temporarily unavailable" exception. To solve this, added VAR_DUMPER_ASYNC
variable, which is true
by default, so won't affect default behavior.
If one faces "failed to open stream: Resource temporarily unavailable" error, he should add VAR_DUMPER_ASYNC=0
to .env
file, and problem would be solved.
Changelog (https://github.com/symfony/var-dumper/compare/v6.2.2...v6.2.3)
Changelog (https://github.com/symfony/var-dumper/compare/v6.1.8...v6.1.9)
Changelog (https://github.com/symfony/var-dumper/compare/v6.0.16...v6.0.17)
Changelog (https://github.com/symfony/var-dumper/compare/v5.4.16...v5.4.17)
Changelog (https://github.com/symfony/var-dumper/compare/v6.2.1...v6.2.2)
Changelog (https://github.com/symfony/var-dumper/compare/v6.2.0...v6.2.1)
Changelog (https://github.com/symfony/var-dumper/compare/v6.2.0-RC2...v6.2.0)
Changelog (https://github.com/symfony/var-dumper/compare/v6.2.0-RC1...v6.2.0-RC2)
Changelog (https://github.com/symfony/var-dumper/compare/v6.2.0-BETA3...v6.2.0-RC1)
Changelog (https://github.com/symfony/var-dumper/compare/v6.2.0-BETA2...v6.2.0-BETA3)
Changelog (https://github.com/symfony/var-dumper/compare/v6.1.6...v6.2.0-BETA1)
FFI\CData
and FFI\CType
types (SerafimArts)Changelog (https://github.com/symfony/var-dumper/compare/v6.1.5...v6.1.6)
Changelog (https://github.com/symfony/var-dumper/compare/v6.0.13...v6.0.14)
Changelog (https://github.com/symfony/var-dumper/compare/v5.4.13...v5.4.14)
Changelog (https://github.com/symfony/var-dumper/compare/v4.4.46...v4.4.47)
Changelog (https://github.com/symfony/var-dumper/compare/v6.1.4...v6.1.5)
Changelog (https://github.com/symfony/var-dumper/compare/v6.0.12...v6.0.13)
Changelog (https://github.com/symfony/var-dumper/compare/v5.4.12...v5.4.13)
Changelog (https://github.com/symfony/var-dumper/compare/v4.4.45...v4.4.46)
Changelog (https://github.com/symfony/var-dumper/compare/v6.1.2...v6.1.3)
Changelog (https://github.com/symfony/var-dumper/compare/v6.0.10...v6.0.11)
Changelog (https://github.com/symfony/var-dumper/compare/v5.4.10...v5.4.11)
Changelog (https://github.com/symfony/var-dumper/compare/v4.4.43...v4.4.44)
Changelog (https://github.com/symfony/var-dumper/compare/v6.1.0-RC1...v6.1.0)
Changelog (https://github.com/symfony/var-dumper/compare/v6.0.8...v6.0.9)
Changelog (https://github.com/symfony/var-dumper/compare/v5.4.8...v5.4.9)
Changelog (https://github.com/symfony/var-dumper/compare/v4.4.41...v4.4.42)
Changelog (https://github.com/symfony/var-dumper/compare/v6.1.0-BETA2...v6.1.0-RC1)
Changelog (https://github.com/symfony/var-dumper/compare/v6.1.0-BETA1...v6.1.0-BETA2)
Changelog (https://github.com/symfony/var-dumper/compare/v6.0.7...v6.0.8)
Laravel Dumper Improve the default output of dump() and dd() in Laravel projects. Improves the default dump behavior for many core Laravel objects, in
Clockwork is a development tool for PHP available right in your browser. Clockwork gives you an insight into your application runtime - including requ
Tracy - PHP debugger Introduction Tracy library is a useful helper for everyday PHP programmers. It helps you to: quickly detect and correct errors lo
RayServer is a beautiful, lightweight web server built on Laravel and VueJs that helps debugging your app. It runs without installation on multiple platforms.
LogViewer By ARCANEDEV© This package allows you to manage and keep track of each one of your log files. NOTE: You can also use LogViewer as an API. Of
APM (Alternative PHP Monitor) APM (Alternative PHP Monitor) is a monitoring extension enabling native Application Performance Management (APM) for PHP
Zipkin PHP is the official PHP Tracer implementation for Zipkin, supported by the OpenZipkin community. Installation composer require openz
PHP Debug Bar Displays a debug bar in the browser with information from php. No more var_dump() in your code! Features: Generic debug bar Easy to inte
Xdebug Xdebug is a debugging tool for PHP. It provides step-debugging and a whole range of development aids, such as stack traces, a code profiler, fe
Kint - debugging helper for PHP developers What am I looking at? At first glance Kint is just a pretty replacement for var_dump(), print_r() and debug
PHPBench is a benchmark runner for PHP analogous to PHPUnit but for performance rather than correctness. Features include: Revolutions: Repeat your co
The interactive PHP debugger Implemented as a SAPI module, phpdbg can exert complete control over the environment without impacting the functionality
Dontbug Debugger Dontbug is a reverse debugger (aka time travel debugger) for PHP. It allows you to record the execution of PHP scripts (in command li
PHP Console A web console to try your PHP code into Creating a test file or using php's interactive mode can be a bit cumbersome to try random php sni
What is Dephpugger? Dephpugger (read depugger) is an open source lib to make a debug in php direct in terminal, without necessary configure an IDE. Th
PCOV A self contained CodeCoverage compatible driver for PHP Requirements and Installation See INSTALL.md API /** * Shall start recording coverage in
phpspy phpspy is a low-overhead sampling profiler for PHP. For now, it works with Linux 3.2+ x86_64 non-ZTS PHP 7.0+ with CLI, Apache, and FPM SAPIs.
whoops PHP errors for cool kids whoops is an error handler framework for PHP. Out-of-the-box, it provides a pretty error interface that helps you debu
Laravel Debugbar This is a package to integrate PHP Debug Bar with Laravel. It includes a ServiceProvider to register the debugbar and attach it to th