<p>You could use for example the <code>dd()</code> method with the <a href="https://github.com/studioespresso/craft3-dumper" rel="nofollow noreferrer">craft3-dumper</a> package.
You can also use the <a href="https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar" rel="nofollow noreferrer">debug toolbar</a>.
You could also use <a href="https://sentry.io/" rel="nofollow noreferrer">Sentry</a> to get a nice overview about your errors with the <a href="https://github.com/lukeyouell/craft-sentry" rel="nofollow noreferrer">craft sentry package</a>.
Or you could use <a href="https://nystudio107.com/blog/using-phpstorm-with-vagrant-homestead" rel="nofollow noreferrer">xdebug</a>. Or or or ... :)</p>

<p>So there are severals ways to debug something.</p>

CC BY-SA 4.0
2019-11-15T07:38:24.493Z
Note that xdebug (with PHPStorm) is by far the most powerful of these options, and will save you a lot of time. Highly recommended.
Udo
CC BY-SA 4.0
2019-11-15T10:28:51.493Z
Hey Chris, Thanks for the answer. Is there any way to log the variables without using like UI tools and additional packages? Like var_dump in php.
apollo
CC BY-SA 4.0
2019-11-15T10:30:09.237Z
Btw, one thing quickly, I have never used PHPstorm, is it a free IDE? :0
apollo
CC BY-SA 4.0
2019-11-15T10:44:51.177Z
For a quick debug use the craft3-dumper package. I am using this a lot too. And in your controller you can just dd($var); like within laravel for example. PHPStorm is not free, but it's one of the best IDE's out there for PHP development in my opinion
Christopher Dosin
CC BY-SA 4.0
2019-11-15T22:14:28.097Z
Thanks, Chris, make sense!
apollo
CC BY-SA 4.0
2019-11-15T06:44:53.213Z
2019-11-15T06:44:53.213Z
Christopher Dosin
<p>I am going to debug the variables in controller files.</p>

<p>But I couldn't figure out how I can debug it and show the values into front-end site or in log files.</p>

<p>Do you have any ideas about this?</p>

<p>What is your debug mode which you often use when you work in a controller?</p>

<craft3><php>
How to debug or log some special variables in Craft CMS? (Especially in a controller)
# How to debug or log some special variables in Craft CMS? (Especially in a controller)

(Asked by: username_0 on 2019-11-15)

I am going to debug the variables in controller files.

But I couldn't figure out how I can debug it and show the values into front-end site or in log files.

Do you have any ideas about this?

What is your debug mode which you often use when you work in a controller?

**Tags:** craft3, php


---

## 1 answers

### Answer by username_1 on 2019-11-15. Score: 3 | Accepted answer

You could use for example the `dd()` method with the [craft3-dumper](https://github.com/studioespresso/craft3-dumper) package.
You can also use the [debug toolbar](https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar).
You could also use [Sentry](https://sentry.io/) to get a nice overview about your errors with the [craft sentry package](https://github.com/lukeyouell/craft-sentry).
Or you could use [xdebug](https://nystudio107.com/blog/using-phpstorm-with-vagrant-homestead). Or or or ... :)

So there are severals ways to debug something.

> **Comments:**
> **username_2**: Note that xdebug (with PHPStorm) is by far the most powerful of these options, and will save you a lot of time. Highly recommended.  
> **username_0**: Hey Chris, Thanks for the answer. Is there any way to log the variables without using like UI tools and additional packages? Like var_dump in php.  
> **username_0**: Btw, one thing quickly, I have never used PHPstorm, is it a free IDE? :0  
> **username_1**: For a quick debug use the craft3-dumper package. I am using this a lot too. And in your controller you can just dd($var); like within laravel for example. PHPStorm is not free, but it's one of the best IDE's out there for PHP development in my opinion  
> **username_0**: Thanks, Chris, make sense!  

---

