Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

baskarks's avatar

process to shift lumen to laravel

what are the steps to shift the lumen project to laravel

0 likes
2 replies
LaryAI's avatar
Level 58

To shift a Lumen project to Laravel, you need to follow several steps. Here’s a detailed guide to help you through the process:

  1. Create a New Laravel Project: First, create a new Laravel project using Composer.

    composer create-project --prefer-dist laravel/laravel laravel-project
    
  2. Copy Lumen Files to Laravel: Copy your Lumen project files to the new Laravel project. This includes your app, routes, config, database, and resources directories. Be careful not to overwrite the Laravel-specific files.

  3. Update Composer Dependencies: Update the composer.json file in your new Laravel project to include any dependencies that were in your Lumen project. Then, run:

    composer update
    
  4. Adjust Configuration Files: Laravel has more configuration files than Lumen. Ensure that you move your Lumen configuration settings to the appropriate Laravel configuration files in the config directory.

  5. Update Bootstrap Files: Lumen and Laravel have different bootstrap files. Ensure that your bootstrap/app.php in Laravel is correctly set up. You might need to adjust service providers and middleware.

  6. Adjust Middleware: Move your Lumen middleware to the appropriate place in Laravel. In Laravel, middleware is typically registered in app/Http/Kernel.php.

  7. Update Routes: Move your Lumen routes to the Laravel routes/web.php or routes/api.php files. Ensure that you adjust any route definitions to match Laravel’s routing syntax if necessary.

  8. Adjust Namespaces: Ensure that all namespaces in your Lumen project are updated to match Laravel’s structure. For example, Lumen might use App\Http\Controllers while Laravel uses App\Http\Controllers.

  9. Update Service Providers: Move any custom service providers from Lumen to Laravel. Register them in the config/app.php file under the providers array.

  10. Test Your Application: Thoroughly test your application to ensure that everything works as expected. This includes running your unit tests, if you have any, and manually testing your application.

Here is an example of how you might adjust a route from Lumen to Laravel:

Lumen Route:

$router->get('/example', 'ExampleController@show');

Laravel Route:

Route::get('/example', [ExampleController::class, 'show']);

By following these steps, you should be able to successfully migrate your Lumen project to Laravel.

martinbean's avatar

@baskarks There isn’t a Shift for this, because the process is far too complicated.

I did this in a previous role. I started by moving files and directories into the default Laravel directory structure. Then I updated the dependencies in the composer.json file. Again, compare your application’s with that a default Laravel app’s composer.json file to know what packages to remove, and which packages to add.

Please or to participate in this conversation.