Ashraful Firoz
Ashraf’s Blog

Ashraf’s Blog

Things I like about Laravel

Things I like about Laravel

Ashraful Firoz's photo
Ashraful Firoz
·Sep 30, 2021·

4 min read

Before I was introduced to MVC architecture, I used plain PHP and HTML for web development, which turned out to be okay for the most part. But as you can guess it gets quite complicated when you want to build something other than a webpage with simple texts.

Previously, I was mostly working and building stuff's with Python, which by the way is my most favorite language till today. I am still looking for something better. So back to the point. One of my clients needed a CRM for their online shop and they wanted to build it specifically with Laravel. Then I started to study more about Laravel and other MVC frameworks.

I looked into Django as I was already quite proficient in python. But as per the client's requirement, I started building the web app with Laravel. To my surprise, I actually liked this framework. I liked it so much that after the first project, I started coding some of my own. Which by the way didn't see any sunlight (haha. just like other hobby projects).

I can literally talk for hours about the pros and cons of Laravel. But in this article, I would like to focus on the pros. Maybe I can tell you about the cons some other day.

Built in Authentication

There might be some exceptions but most of the time you just want to focus on the project rather than inventing a user login on your own. In my sense, one of the most useful features of Laravel is its built-in Authentication system. Most of the login/signup related features are built right into default laravel installation. You hardly need to adjust any parameter.

Previously I was very happy with Laravel's ui package. Then suddenly they choose to implement jetstream with fortify. On top of that you will be using inertia or livewire for rendering the auth pages. I am not saying that they are inconvenient. I am just saying it may have become more complicated than it needs to be.

You can still use Laravel ui package or as suggested you should be using Laravel breeze from now on.

MVC architecture

At first, you might be overwhelmed by all the little details about using Laravel. But once you get to know the simple principle of MVC or (Model, View, Controller) you will be amazed to see how easy it is to code with laravel. For most projects from simple ones to complex ones, I find laravel's architecture very useful.

File Storage Support

Out of the box Laravel supports multiple file systems. One of the most important file systems in todays web world is none other than AWS s3. Laravel has been supporting s3 for a long time. So if your project needs native s3 support. You should jump into Laravel without wasting any more time.

One other important factor about using s3 with laravel is "Caching". Lets say you have a file in s3 that you access very frequently. Now if every time the request is sent to aws then it can get quite costly very easily. So laravel came with caching. You can cash s3 objects. So it gets fetched once and saved to your system. Then it gets served from there.

Rich Cli

Like all other frameworks, laravel has a pretty unique cli tool called artisan. Which can be used with "php artisan" command. It has a bunch of small snippets that can help you build your app faster than ever. Like when creating a model seeder, You can just execute "php artisan make:seeder DemoSeeder" and it will create a DemoSeeder class in the appropriate folder. You can pretty much generate all classes needed for Larvel with Artisan. Except for your own classes.

Everything related to laravel is done through this tool and if you are looking forward to be an expert in laravel then definitely keep an eye on for artisan commands.

Unit Testing

Yeah yeah, I know how we programmers hate testing so much. But let's be honest for a second, it's pretty easy to see the benefits of unit testing. If you are not confident enough with your code then how are you gonna push code to production? Also when a single project gets really big it gets quite hard to manually check the features with each new update. That's why unit testing is a must.

Larvel has Php's famous unittest module built-in. Laravel also has a tool called Laravel Dusk. Which is a selenium like testing interface for Laravel. With dusk you can test with real browser. It's kind of convenient having all these tools in one place.

In the end, I should mention Laravel's template processing engine "Blade" which offers enormous functionality compared to others.

Mentioned above are some of the things I find really interesting about Laravel. But it doesn't mean there aren't any others. There is plenty. But these features should be enough to get you interested in Laravel. Which I am pretty sure that you are thinking at this point.

Share this