Organizing routes in Laravel 4

Reading time ~1 minute

Laravel 4 is centered almost completely around routing. So organizing it is a must. There is no default organization for routes, but we can easily fix this.

Add the following to your `bootstrap/start.php` file:

<?
/**
 * Require Routes for better organization.
 */
$files = new FilesystemIterator(dirname(dirname(__FILE__)) . '/app/routes');
foreach ($files as $file)
{
    if ($file->isFile())
    {
        require $file->getPathname();
    }
}
Then you can create a `routes` directory inside the `app` folder and save your routes in there. You can name them whatever you want, but I like to name them after the controller I am working on.

Happy coding!

Quick Laravel/Lumen install with Docker!

The default installer that comes with Laravel is great, but unfortunately that means you have to install dependencies of PHP and Laravel/...… Continue reading

PHP To Python

Published on February 24, 2016

Aftertouch in Logic Pro X and 2015 Macbook Pro

Published on February 24, 2016