I’ve been working with Yii framework version 2.0 for a few days now, and I find Yii’s Debugger and vardumper function are extremely uncomfortable!
Since for the sake of Simplicity and Quick Development, I’ve created a helper for those who use Yii. You can just call dd($var1, $var2, ….); for dump & die or d($var1, $var2, ….); for dump data.
p/s: Please scroll to the end of this article for sample result.
p/s 2: Those functions work with all PHP version
Installation:
- Create a file so called functions.php in
/common/config/
- Paste those code into function.php then save it
- Now, edit bootstrap.php in
/common/config/bootstrap.php
and then add this line of code to the top:
like so
Voila! Now you can call d($var1, $var2, $varx); for dump or dd($var1, $var2, $varx) for dump then die anywhere in your application!
Sample result:
![](http://one.prod.3si.vn/web/image/2299/5.png?access_token=d00ac025-0c01-4800-a395-4d9a159b24bf)
- Call Debug function
![](/web/image/30684-fe55ac3c/6%20%284%29.png?access_token=1790fd8d-c6e9-4bde-83ce-dffe00901515)
![](http://one.prod.3si.vn/web/image/2300/6.png?access_token=2f7925e5-4954-4dc8-8bdd-4fc001a8a4fb)
- Debug result