Cakephp 3 Debugkit

Asked

Viewed 55 times

0

In Cakephp 2 I usually enable/disable Debubkit by Appcontroller, according to the user who is logged in to the system:

// AppController -> CakePHP 2
public function beforeFilter(){
   parent::beforeFilter();
   ...
   if($this->usuario_logado_id > 1)
      Configure::write('debug', 0);
}

However, in Cakephp 3, Debugkit is loaded from "Application.php"

// Application.php -> CakePHP 3
public function bootstrap(){
   parent::bootstrap();
   ...
   $this->addPlugin(\DebugKit\Plugin::class);
}

Is there any way to disable Debubkit from Appcontroller as I do in Cakephp 2 ?

I’ve tried many different ways, but without success.

  • You can disable the configuration file (config/app.php) by setting the debug flag to false

  • From what I read in the documentation, it is not possible to do it by a controller, only by Application.php

  • The problem with disabling the.php app is that it should be manual. In Cakephp2 I enable it for myself and leave it disabled for other users.

  • you use Debugkit or just debug? debug is possible to have its dynamic value the way you want, debugkit is not possible

  • The debug I managed to disable dynamically... Debugkit does not, sometimes it is necessary to use it.

1 answer

0

You, a programmer, will use the application in a development environment. Other users will use it in a production environment. The copy on your machine must have debug enabled. The copy on the server must have disabled it. You don’t mix this, and you shouldn’t put those files in git either. It’s safer to do it via ftp.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.