Printing your data in browser console
composer require izica/php-browser-log
You need to use this debug in html view. You will see result in browser console(F12, Inspect mode console);
PhpBrowserLog::log($arg1);
PhpBrowserLog::log($arg1, $arg2);
PhpBrowserLog::log(...any args count);
or Aliases
PhpBrowserLog::pre($arg1);
pre($arg1, $arg2);