Toolbar.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Config\BaseConfig;
  4. use CodeIgniter\Debug\Toolbar\Collectors\Database;
  5. use CodeIgniter\Debug\Toolbar\Collectors\Events;
  6. use CodeIgniter\Debug\Toolbar\Collectors\Files;
  7. use CodeIgniter\Debug\Toolbar\Collectors\Logs;
  8. use CodeIgniter\Debug\Toolbar\Collectors\Routes;
  9. use CodeIgniter\Debug\Toolbar\Collectors\Timers;
  10. use CodeIgniter\Debug\Toolbar\Collectors\Views;
  11. /**
  12. * --------------------------------------------------------------------------
  13. * Debug Toolbar
  14. * --------------------------------------------------------------------------
  15. *
  16. * The Debug Toolbar provides a way to see information about the performance
  17. * and state of your application during that page display. By default it will
  18. * NOT be displayed under production environments, and will only display if
  19. * `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
  20. */
  21. class Toolbar extends BaseConfig
  22. {
  23. /**
  24. * --------------------------------------------------------------------------
  25. * Toolbar Collectors
  26. * --------------------------------------------------------------------------
  27. *
  28. * List of toolbar collectors that will be called when Debug Toolbar
  29. * fires up and collects data from.
  30. *
  31. * @var list<class-string>
  32. */
  33. public array $collectors = [
  34. Timers::class,
  35. Database::class,
  36. Logs::class,
  37. Views::class,
  38. // \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
  39. Files::class,
  40. Routes::class,
  41. Events::class,
  42. ];
  43. /**
  44. * --------------------------------------------------------------------------
  45. * Collect Var Data
  46. * --------------------------------------------------------------------------
  47. *
  48. * If set to false var data from the views will not be collected. Useful to
  49. * avoid high memory usage when there are lots of data passed to the view.
  50. */
  51. public bool $collectVarData = true;
  52. /**
  53. * --------------------------------------------------------------------------
  54. * Max History
  55. * --------------------------------------------------------------------------
  56. *
  57. * `$maxHistory` sets a limit on the number of past requests that are stored,
  58. * helping to conserve file space used to store them. You can set it to
  59. * 0 (zero) to not have any history stored, or -1 for unlimited history.
  60. */
  61. public int $maxHistory = 20;
  62. /**
  63. * --------------------------------------------------------------------------
  64. * Toolbar Views Path
  65. * --------------------------------------------------------------------------
  66. *
  67. * The full path to the the views that are used by the toolbar.
  68. * This MUST have a trailing slash.
  69. */
  70. public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
  71. /**
  72. * --------------------------------------------------------------------------
  73. * Max Queries
  74. * --------------------------------------------------------------------------
  75. *
  76. * If the Database Collector is enabled, it will log every query that the
  77. * the system generates so they can be displayed on the toolbar's timeline
  78. * and in the query log. This can lead to memory issues in some instances
  79. * with hundreds of queries.
  80. *
  81. * `$maxQueries` defines the maximum amount of queries that will be stored.
  82. */
  83. public int $maxQueries = 100;
  84. /**
  85. * --------------------------------------------------------------------------
  86. * Watched Directories
  87. * --------------------------------------------------------------------------
  88. *
  89. * Contains an array of directories that will be watched for changes and
  90. * used to determine if the hot-reload feature should reload the page or not.
  91. * We restrict the values to keep performance as high as possible.
  92. *
  93. * NOTE: The ROOTPATH will be prepended to all values.
  94. *
  95. * @var list<string>
  96. */
  97. public array $watchedDirectories = [
  98. 'app',
  99. ];
  100. /**
  101. * --------------------------------------------------------------------------
  102. * Watched File Extensions
  103. * --------------------------------------------------------------------------
  104. *
  105. * Contains an array of file extensions that will be watched for changes and
  106. * used to determine if the hot-reload feature should reload the page or not.
  107. *
  108. * @var list<string>
  109. */
  110. public array $watchedExtensions = [
  111. 'php', 'css', 'js', 'html', 'svg', 'json', 'env',
  112. ];
  113. }