Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
Last active October 13, 2018 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasrulhazim/4dc925a92a6db466039a733b82fa6e21 to your computer and use it in GitHub Desktop.
Save nasrulhazim/4dc925a92a6db466039a733b82fa6e21 to your computer and use it in GitHub Desktop.
How to Include Lumen (5.3) in Laravel (5.3)
  1. Create a directory in laravel application called lumen
	lumen
		public
			.htaccess
			index.php
		config
			- api.php
			- jwt.php
		bootstrap.php 
  1. Grab content from bootstrap/app.php and paste it into lumen\bootstrap.php

  2. Replace App\Console\Kernel::class with App\Lumen\Console\Kernel::class.

  3. Comment out the current route $app->group(['namespace' => 'App\Http\Controllers'],... and use the following route:

$app->get('/', function () use ($app) {
    return $app->version();
});
  1. Copy Lumen's app folder into Laravel's app folder as Lumen.

  2. Update the namespace of namespace App\ folder to namespace App\Lumen\.

  3. In Laravel root folder, run composer require laravel/lumen to include Lumen package dependencies.

Now you may run in Laravel's public directory php artisan serve and Lumen's public folder php -S localhost:9000 to serve both application. You should see Laravel and Lumen default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment