Answers.Body: <p>Craft 3</p>
  
  <p>If you enabled the debug toolbar in the user profile, but it still does not show on the frontend, AND you are running Craft not locally but on a different host (different IP), try adding this to your config/app.php:</p>
  
  <pre><code>'local'  =&gt; [
      'bootstrap' =&gt; ['debug'],
      'modules' =&gt; [
          'debug' =&gt; [
              'class' =&gt; 'yii\debug\Module',
              // uncomment and adjust the following to add your IP if you are not connecting from localhost.
              'allowedIPs' =&gt; ['127.0.0.1', '::1', '*.*.*.*'],
          ]
      ]
  ],
  </code></pre>
  
  <p>(I added this to the "local" block since I do my development on a remote server - be sure to only enable this for non-public development / staging servers, as it may cause security issues). If you have a static IP use that instead of the wildcards. </p>
  
  <p>Sources:
  <a href="https://www.yiiframework.com/extension/yiisoft/yii2-debug" rel="nofollow noreferrer">https://www.yiiframework.com/extension/yiisoft/yii2-debug</a> and
  <a href="https://github.com/yiisoft/yii2-debug/blob/15526e95239fcd53316866f9f32cd5daf3a087e5/src/Module.php#L30" rel="nofollow noreferrer">https://github.com/yiisoft/yii2-debug/blob/15526e95239fcd53316866f9f32cd5daf3a087e5/src/Module.php#L30</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-07T13:55:59.947Z
Answers.Text: When I use `'dev` => [` which is the name of my dev env, I simply get an error `Setting unknown property: craft\web\Application::dev` - do you know how I would restrict this to my dev environment?
Answers.UserDisplayName: Daniel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-14T09:32:22.133Z
Answers.LastActivityDate: 2018-07-16T19:44:00.363Z
Answers.LastEditDate: 2018-07-16T19:44:00.363Z
Answers.UserDisplayName: Udo
Answers.Body: <p>For anyone finding it annoying having to be authenticated to enable the debug bar, particularly when testing in multiple browsers, it’s easy to override this behaviour with a <a href="https://github.com/craftcms/craft/blob/master/modules/Module.php" rel="nofollow noreferrer">custom module</a>.</p>
  <p>Just add the following to your <code>init()</code> code:</p>
  <pre class="lang-php prettyprint-override"><code>// In dev envs override user debug toolbar prefs based on devMode setting
  if (getenv('ENVIRONMENT') === 'dev' &amp;&amp; ! Craft::$app-&gt;getRequest()-&gt;getIsConsoleRequest()) {
      $session = Craft::$app-&gt;getSession();
      $session-&gt;set('enableDebugToolbarForSite', Craft::$app-&gt;config-&gt;general-&gt;devMode);
  }
  </code></pre>
  <p>The above code toggles the debug bar based on the devMode setting, and only in your dev environment. This is handy as you can quickly set devMode to false to test a production-like response.</p>
  <p>Bear in mind that because this calls <code>$session-&gt;set</code>, even if you delete the code, your current session will retain whatever preference you last had set.</p>
  <p><strong>2022 Edit:</strong> I’m not sure when the above code was broken, but as @drifteaur pointed out in the comments, it is possible to set an <code>X-Debug</code> header to toggle the toolbar and this can be manipulated via module code too. For instance:</p>
  <pre class="lang-php prettyprint-override"><code>if (getenv('ENVIRONMENT') === 'development' &amp;&amp; ! Craft::$app-&gt;getRequest()-&gt;getIsConsoleRequest()) {
    $request = Craft::$app-&gt;getRequest();
    $request-&gt;headers-&gt;set('X-Debug', 'enable');
  }
  </code></pre>
  <p>This works fine with the current Craft 3.7 release but is untested for Craft 4.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-12T12:46:22.470Z
Answers.Text: Keep in mind this will throw an exception for all Console requests
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-12T13:08:15.330Z
Answers.Text: So it does, I’ve added a fix for that.
Answers.UserDisplayName: Dom Stubbs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-15T17:08:56.143Z
Answers.Text: This no longer seems to work. But setting the X-Debug header to 'enable' (via a header modification browser extension, for example) enables the debug toolbar. See web/Application.php#debugBootstrap()
Answers.UserDisplayName: drifteaur
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-12T11:52:52.673Z
Answers.LastActivityDate: 2022-09-13T11:08:21.700Z
Answers.LastEditDate: 2022-09-13T11:08:21.700Z
Answers.UserDisplayName: Dom Stubbs
Answers.Body: <p>There are two checkboxes in your user settings, go to your admin account -> preferences <code>index.php?p=admin/myaccount</code> and check the boxes</p>
  
  <p>This is covered in detail in the <a href="https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar" rel="nofollow noreferrer">Profiling your Website with Craft CMS 3’s Debug Toolbar</a> article</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-09T19:06:41.983Z
Answers.Text: I did that as well but the front end console won't show up but the cp does.
Answers.UserDisplayName: Mark H.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-05T14:53:14.980Z
Answers.Text: This may seem obvious but if you've enabled the debug toolbar for the front end and can't see it. Check your HTML for unclosed divs etc. 
  
  This can prevent the debug toolbar from being shown on pages with broken HTML.
Answers.UserDisplayName: billythekid
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-06T22:06:14.730Z
Answers.Text: @RobinSchambach - It looks like one must be logged in to a secondary site in order to see the debug toolbar.
Answers.UserDisplayName: 4midori
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-06T22:19:41.810Z
Answers.Text: Any way to enable this for secondary sites, using the Control Panel?
Answers.UserDisplayName: 4midori
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-06T22:20:47.730Z
Answers.Text: What do you mean by secondary sites?
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-07T15:15:24.337Z
Answers.Text: I don't really see an issue. You can have the debug toolbar for whatever site you want
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-01-23T09:17:14.627Z
Answers.LastActivityDate: 2018-07-17T21:26:34.487Z
Answers.LastEditDate: 2018-07-17T21:26:34.487Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I'm using Craft 3 RC and I am logged as an admin. How can I display the Yii debug toolbar on front-end and Control Panel requests? By default, I don't see this toolbar.</p>
  
Tags: <craft3><debugging><yii>
Title: Craft 3: how to show the Yii Debug Toolbar?
ThreadText: # Craft 3: how to show the Yii Debug Toolbar?
  
  (Asked by: username_0 on 2018-01-23)
  
  I'm using Craft 3 RC and I am logged as an admin. How can I display the Yii debug toolbar on front-end and Control Panel requests? By default, I don't see this toolbar.
  
  **Tags:** craft3, debugging, yii
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_4 on 2018-01-23. Score: 9 | Accepted answer
  
  There are two checkboxes in your user settings, go to your admin account -> preferences `index.php?p=admin/myaccount` and check the boxes
  
  This is covered in detail in the [Profiling your Website with Craft CMS 3’s Debug Toolbar](https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar) article
  
  > **Comments:**
  > **username_6**: I did that as well but the front end console won't show up but the cp does.  
  > **username_8**: Any way to enable this for secondary sites, using the Control Panel?  
  > **username_4**: What do you mean by secondary sites?  
  > **username_4**: I don't really see an issue. You can have the debug toolbar for whatever site you want  
  > **username_7**: This may seem obvious but if you've enabled the debug toolbar for the front end and can't see it. Check your HTML for unclosed divs etc.   This can prevent the debug toolbar from being shown on pages with broken HTML.  
  > **username_8**: @username_4 - It looks like one must be logged in to a secondary site in order to see the debug toolbar.  
  
  ---
  
  ### Answer by username_1 on 2018-07-14. Score: 5
  
  Craft 3
  
  If you enabled the debug toolbar in the user profile, but it still does not show on the frontend, AND you are running Craft not locally but on a different host (different IP), try adding this to your config/app.php:
  
  ```
  'local'  => [
      'bootstrap' => ['debug'],
      'modules' => [
          'debug' => [
              'class' => 'yii\debug\Module',
              // uncomment and adjust the following to add your IP if you are not connecting from localhost.
              'allowedIPs' => ['127.0.0.1', '::1', '*.*.*.*'],
          ]
      ]
  ],
  
  ```
  
  (I added this to the "local" block since I do my development on a remote server - be sure to only enable this for non-public development / staging servers, as it may cause security issues). If you have a static IP use that instead of the wildcards.
  
  Sources:
  <https://www.yiiframework.com/extension/yiisoft/yii2-debug> and
  <https://github.com/yiisoft/yii2-debug/blob/15526e95239fcd53316866f9f32cd5daf3a087e5/src/Module.php#L30>
  
  > **Comments:**
  > **username_2**: When I use `'dev` => [` which is the name of my dev env, I simply get an error `Setting unknown property: craft\web\Application::dev` - do you know how I would restrict this to my dev environment?  
  
  ---
  
  ### Answer by username_3 on 2019-03-12. Score: 5
  
  For anyone finding it annoying having to be authenticated to enable the debug bar, particularly when testing in multiple browsers, it’s easy to override this behaviour with a [custom module](https://github.com/craftcms/craft/blob/master/modules/Module.php).
  
  Just add the following to your `init()` code:
  
  ```php
  // In dev envs override user debug toolbar prefs based on devMode setting
  if (getenv('ENVIRONMENT') === 'dev' && ! Craft::$app->getRequest()->getIsConsoleRequest()) {
      $session = Craft::$app->getSession();
      $session->set('enableDebugToolbarForSite', Craft::$app->config->general->devMode);
  }
  
  ```
  
  The above code toggles the debug bar based on the devMode setting, and only in your dev environment. This is handy as you can quickly set devMode to false to test a production-like response.
  
  Bear in mind that because this calls `$session->set`, even if you delete the code, your current session will retain whatever preference you last had set.
  
  **2022 Edit:** I’m not sure when the above code was broken, but as @username_5 pointed out in the comments, it is possible to set an `X-Debug` header to toggle the toolbar and this can be manipulated via module code too. For instance:
  
  ```php
  if (getenv('ENVIRONMENT') === 'development' && ! Craft::$app->getRequest()->getIsConsoleRequest()) {
    $request = Craft::$app->getRequest();
    $request->headers->set('X-Debug', 'enable');
  }
  
  ```
  
  This works fine with the current Craft 3.7 release but is untested for Craft 4.
  
  > **Comments:**
  > **username_4**: Keep in mind this will throw an exception for all Console requests  
  > **username_3**: So it does, I’ve added a fix for that.  
  > **username_5**: This no longer seems to work. But setting the X-Debug header to 'enable' (via a header modification browser extension, for example) enables the debug toolbar. See web/Application.php#debugBootstrap()  
  
  ---
  
  