adilsaeed31's avatar

Difference between Laravel and Lumen.

HI,

I have checked there is a difference in lumen btw. We don't have models in lumen but we can add model class in route.php and we can use them. we also can use controller but what if we need to call a model in controller. We have route.php file we can do everything here, but why we need controller then etc, i have lots of confusion regarding this. Can anyone explain me better.

Thanks in Advance. Adil

0 likes
12 replies
pmall's avatar

Lumen is for making simple api, basically just routing and serving data. Laravel is the full stack.

martinbean's avatar

@adilsaeed31 Lumen is to Laravel as what Silex is to Symfony: a slimmed down version. Think of it as Laravel Lite or Diet Laravel.

adilsaeed31's avatar

Thanks for reply actually guys I know about this. My actual confusion why we need to create model class in route.php why we need to right logic in route instead of controllers. Any idea. I mean we can do anything in route.php then why we need MVC structure for lumen.

Hope it understands.

Thanks Adil

adilsaeed31's avatar

Do u know why we can do every thing in route.php then why we need controllers.

jekinney's avatar
Level 47

@adilsaeed31 it's the fundamental purpose of mvc pattern. A quick Google search will explain it better as it's well documented pros and cons. Laravel offers freedom to do what you want so you don't have to stick to the "rules" of mvc. I know devs, including myself test functions, queries, browser test and play around and will establish a class model and call it directly in the routes file. I personally wouldn't deploy code that way. But that choice is yours to make.

martinbean's avatar

@adilsaeed31 Just because you can do something, doesn’t mean you should. Defining model classes in your routes file is one of those things.

adilsaeed31's avatar

@martinbean thanks for answers, you are right, we should use routes as for routings however we have controllers n models n middleware. The programmers definitely need to stick with framework standards.

adilsaeed31's avatar

That's right laravel gives us freedom in routes.php file to do anything. However what I'm thinking is lumen should have this kind of freedom instead of laravel, because lumen is micro framework specially for api's n web services and Laravel is full framework for a complete huge level applications.

Let me know if I'm wrong.

davorminchorov's avatar

Laravel has a redish color and lumen has an orange color on the website!

3 likes

Please or to participate in this conversation.