# Debugging

## Symfony debugger

On your local development environment you will see the Symfony debug bar which displays:

![Symfony debugger](https://803759907-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsCWX51EQA73ljbdzImgV%2Fuploads%2Fgit-blob-d21736947a60c92f8738ced94409a1afc0bd5eff%2Fsymfony-debugger.png?alt=media)

* HTTP status code
* Matching route
* Page generation time and memory usage
* Twig template generation time

### Inspecting template variables

The controller defines the variables to pass onto the view. Example controller code:

```php
return $this->render('news/article.html.twig', [
    'url' => sprintf('/news/%s', $slug),
    'page' => $page
]);
```

You can then inspect the variable via the `dump()` command.

When used in your template, this will output the variable directly to the page. E.g.

```
{{ dump(page) }}
```

![Inspecting a variable via debug (in a template)](https://803759907-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsCWX51EQA73ljbdzImgV%2Fuploads%2Fgit-blob-848737058e06fe5b3c43b90a08a62ed97cbd3fb3%2Fdump-variable.png?alt=media)

The above example shows the `page` object which represents, in this instance, a news post from WordPress.

The inspector shows the object types for each content field, you can find out more about these at [Content Fields](https://docs.strata.dev/frontend/templating/broken-reference).

### Inspecting variables in PHP

You can also use the `dump()` function in PHP, this will output the variable to the Symfony debugger inspector. E.g.

```
dump($page);
```

Select the inspector icon ![Inspector icon](https://803759907-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsCWX51EQA73ljbdzImgV%2Fuploads%2Fgit-blob-0a7e050b69610279f652be01e56deee0c47cbf7e%2Fsymfony-debugger-inspect-icon.png?alt=media) to inspect the variable.

![Inspecting a variable via debug (in PHP)](https://803759907-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsCWX51EQA73ljbdzImgV%2Fuploads%2Fgit-blob-1986b58ba309f78d95b97b0c49a72e1020ef89d0%2Fsymfony-debugger-dump-variable.png?alt=media)

The example above also shows the debug bar with an error, additional information such as the error details can be accessed from here.
