Routing.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * This file is part of CodeIgniter 4 framework.
  4. *
  5. * (c) CodeIgniter Foundation <[email protected]>
  6. *
  7. * For the full copyright and license information, please view
  8. * the LICENSE file that was distributed with this source code.
  9. */
  10. namespace Config;
  11. use CodeIgniter\Config\Routing as BaseRouting;
  12. /**
  13. * Routing configuration
  14. */
  15. class Routing extends BaseRouting
  16. {
  17. /**
  18. * An array of files that contain route definitions.
  19. * Route files are read in order, with the first match
  20. * found taking precedence.
  21. *
  22. * Default: APPPATH . 'Config/Routes.php'
  23. */
  24. public array $routeFiles = [
  25. APPPATH . 'Config/Routes.php',
  26. ];
  27. /**
  28. * The default namespace to use for Controllers when no other
  29. * namespace has been specified.
  30. *
  31. * Default: 'App\Controllers'
  32. */
  33. public string $defaultNamespace = 'App\Controllers';
  34. /**
  35. * The default controller to use when no other controller has been
  36. * specified.
  37. *
  38. * Default: 'Home'
  39. */
  40. public string $defaultController = 'Home';
  41. /**
  42. * The default method to call on the controller when no other
  43. * method has been set in the route.
  44. *
  45. * Default: 'index'
  46. */
  47. public string $defaultMethod = 'index';
  48. /**
  49. * Whether to translate dashes in URIs to underscores.
  50. * Primarily useful when using the auto-routing.
  51. *
  52. * Default: false
  53. */
  54. public bool $translateURIDashes = false;
  55. /**
  56. * Sets the class/method that should be called if routing doesn't
  57. * find a match. It can be either a closure or the controller/method
  58. * name exactly like a route is defined: Users::index
  59. *
  60. * This setting is passed to the Router class and handled there.
  61. *
  62. * If you want to use a closure, you will have to set it in the
  63. * class constructor or the routes file by calling:
  64. *
  65. * $routes->set404Override(function() {
  66. * // Do something here
  67. * });
  68. *
  69. * Example:
  70. * public $override404 = 'App\Errors::show404';
  71. */
  72. public ?string $override404 = null;
  73. /**
  74. * If TRUE, the system will attempt to match the URI against
  75. * Controllers by matching each segment against folders/files
  76. * in APPPATH/Controllers, when a match wasn't found against
  77. * defined routes.
  78. *
  79. * If FALSE, will stop searching and do NO automatic routing.
  80. */
  81. public bool $autoRoute = false;
  82. /**
  83. * If TRUE, will enable the use of the 'prioritize' option
  84. * when defining routes.
  85. *
  86. * Default: false
  87. */
  88. public bool $prioritize = false;
  89. /**
  90. * Map of URI segments and namespaces. For Auto Routing (Improved).
  91. *
  92. * The key is the first URI segment. The value is the controller namespace.
  93. * E.g.,
  94. * [
  95. * 'blog' => 'Acme\Blog\Controllers',
  96. * ]
  97. *
  98. * @var array [ uri_segment => namespace ]
  99. */
  100. public array $moduleRoutes = [];
  101. }