Use Spiral\Debug\Dumper
class or function dump
to view content of your variables and instances without xDebug:
protected function indexAction(Dumper $dumper, MemcacheStore $memcacheStore)
{
$dumper->dump($memcacheStore);
}
protected function indexAction(MemcacheStore $memcacheStore)
{
dump($memcacheStore);
}
The Spiral Dumper
supports the __debugInfo
method which allows you to dump only relevant information.
In your code (works in web and CLI SAPIs):
use Spiral\Debug;
$d = new Debug\Dumper();
$d->dump($variable);
Dump to Log:
use Spiral\Debug;
$d = new Debug\Dumper($loggerInterface);
$d->dump($variable, Debug\Dumper::LOGGER);
Dump to STDERR:
use Spiral\Debug;
$d = new Debug\Dumper($loggerInterface);
$d->dump($variable, Debug\Dumper::STDERR);
Force dump to STDERR with color support:
use Spiral\Debug;
$d = new Debug\Dumper($loggerInterface);
$d->setRenderer(Debug\Dumper::STDERR, new Debug\Renderer\ConsoleRenderer());
$d->dump($variable, Debug\Dumper::STDERR);
You can use function
dump
as a shortcut. Usedumprr
to dump to the RoadRunner error log.
To hide specific fields of your objects without the __debugInfo
method, add an "@internal" annotation to your property.
class TestService
{
/**
* @internal
* @var ContainerInterface
*/
protected $container = null;
}
You can dump variable into roadrunner debug log using function dumprr
. Make sure to use this function in your job handlers.