mmeyer2k has written a good tutorial about using one installation of Laravel to power multiple applications.

Laravel 5 is awesome, but out of the box, it seems to only allow for a single web root to be served for each installation. However, with a few minor tweaks, one installation of the framework can power any number of applications.

Handling the public/ folder

Most of the time, the public/ folder IS the webroot. For our purpose, public/example/ will be the new structure. This gives us the flexibility to add as many roots as needed.

To turn /public/example into a webroot, place the following into /public/example/index.php:

<?php

// Set a variable that contains the name of the
// webroot that was entered. This will be
// used to load the correct route file.
define('PUBLIC_SUBROOT', basename(__DIR__));

// Launch laravel as normal.
require __DIR__ . '/../index.php';

Re-Routing

Usually in Laravel 5, an applications’s routes are stored at /app/Http/routes.php. All that needs to be done to make this trick work is to modify this file to contain something like the following:

<?php

require base_path('/resources/routes/' . PUBLIC_SUBROOT . '.php');

Now when a request comes into example.com (or where ever) Laravel will run and execute the /resources/routes/example.php file. Laravel should be working as usual now.

Some things will break!