As you continually add more and more routes to Routes.php it gets bigger and bigger. How do you organize them?
I created a directory /application/routes/ and added files in there. Each file is just a set of routes. Then in routes.php I added the following code to include them all:
// Dynamically include all files in the routes directory foreach (new DirectoryIterator(__DIR__.DS.'routes') as $file) { if (!$file->isDot() && !$file->isDir() && $file->getFilename() != '.gitignore') { require_once __DIR__.DS.'routes'.DS.$file->getFilename(); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With