dominicwatts/magentodump

Magento with Symfony VarDumper replacement to Zend_Debug

Installs: 268

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 3

Open Issues: 0

Type:magento2-module

1.0.1 2019-07-26 21:53 UTC

This package is auto-updated.

Last update: 2024-10-25 10:54:13 UTC


README

Magento with Symfony VarDumper replacement to Zend_Debug

Install demo instructions

composer require dominicwatts/magentodump

php bin/magento setup:upgrade

Go to /xigen_magentodump/index/dump to see some of the possibilities

Install VarDumper instructions

composer require symfony/var-dumper

Usage Instructions

Can be used as part of a class

use Symfony\Component\VarDumper\VarDumper;

/**
 * Class Dump
 * @package Xigen\MagentoDump\Block\Index
 */
class Dump extends \Magento\Framework\View\Element\Template
{
    /**
     * Constructor
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        array $data = []
    ) {
        parent::__construct($context, $data);
    }

    /**
     * Dump the variable
     * @param $dumpMe mixed
     */
    public function dump($dumpMe)
    {
        VarDumper::dump($dumpMe);
    }
}

Or within phtml

<p>Hello index/dump.phtml</p>
<?php

Symfony\Component\VarDumper\VarDumper::dump('test');

$block->dump('test');

$block->dump(['arrayone', 'arraytwo']);

$object = ['key' => 'item'];

$block->dump(['array', 1, new Magento\Framework\DataObject($object)]);

?>

Demo output

Demo