"They've got docker setup upfront, that's awesome !!" - on the first day of learning laravel
I don't know what you think about PHP, but the developer experience with Laravel has been really good, and it motivates me to write this blog.
My background with other Frameworks / Libs
Here are the top 5 things I liked about Laravel.
Automated dockerizing with
- Managing different database types/versions and switching between them for different projects gets messy.
- With Laravel Sail, you can get your laravel application and the database of your choice within a docker container in no time.
- The Best part,
sail cliconnects you with your dockerized laravel application from outside docker.
Server Side Rendering with
- If your frontend is complex, separating it out would be better and ideally
NextJs / NuxtJs / etcwould be the way to go.
- But, when it comes to writing SSR code within your backend application, this framework really shines here. Writing SSR code with Laravel Blade is way cleaner than the
Express + EJSduo.
- You get more powerful directives, multiple ways to nest components, custom directives, etc. If your component involves heavy logic, you can create class-based components too.
Consider an example where you have to show some posts to a logged in user, skipping the first post.
Laravel Blade creates an "aha" moment.
Application bootstrapping and Dependency Injection
- The Laravel application instance is called a
service container. You can bind a class instance to a
service containeras a singleton and reuse it wherever you want.
- Laravel automatically resolves constructor injection and method injection (
kinda like NestJs).
AppServiceProvideryou can easily swap out what dependency gets injected by default.
Migrations, Factories and Query Builder
- Writing migrations and seeding the database is easy.
- Personally, I have used
Sequelizeheavily and working with migrations in
Sequelizehas some initial learning curve.
- I found laravel migrations cleaner. Also, laravel has out of the box developer-friendly query builder, like
TypeORMbut more flexible.
Consider the example below where we want to include relations Author, Category, Comments with a Post table and filter the results by Post body and Category name.
Top-notch support for
- With NodeJs frameworks, adding(and updating) npm packages is more frequent, you usually install an npm package for any miscellaneous requirement.
- Laravel has inbuilt/supplemented support for authentication, request validation, cron jobs, mailing, event handling, http requests, notifications, caching, file storage, OAuth etc.
The above reviews were solely based on developer experience. Laravel is relatively slower than other backend frameworks, but it does fine for most of your requirements.
There's something unique to learn from every framework (I learned some new design patterns in Laravel) and it's important to not get attached to the one you are using.
I work as a Software Engineer Intern at ClearGlass, we are a Cost Transparency company based out of London, UK.
ClearGlass is looking for Senior Software Engineers for the Engineering team. Most of our tech stack is in NodeJS / PHP. Know more about us and apply here. Learn about our tech stack here
See you there 👋.
Top comments (2)
If you like a fullstack framework like Laravel, I’d like to introduce Ruby on Rails to you 😉
If u want such a framework Rails is the standard. There is a sentence "Rails like framework " and Laravel is that.