So I’ve been coding in php for 4years now. During this time, I’ve embarked on various projects of different sizes and capacities , most of which where “cognitively demanding”.
Late 2020,One of these projects required me to transition legacy architecture based on PHP and server-side HTML generation, and transition to REST API. With this old style, back-end developers were expected to know much more about the UI and visual aspects of the application. Due to this, backend devs had to pay attention to different segments of the application, instead of focusing on their primary objective. But this approach is quite lame, the backend-api approach encourages developers to specialize and focus on their code,because it’s separated from the UI, it leads to more quality code in the long run.
Also, testing API services is much easier as REST API can be verified by automated unit testing.
My usual approach would’ve been to go ahead with my own personal framework Eden(which I built myself😁),but there were tons of stuff to worry about. What you might say?🤷🏾♂️. For starters I was constantly tinkering with the framework code,trying to squeeze in new features where I could,and everything usually becomes messy.which brings me to my second reason,most other developers found it difficult to work with my framework because, the syntax wasn’t what they were use to,although the framework was packed with features like routing ,caching,ORM,dependency injection e.t.c. It just wasn’t flexible enough.
So what did I do?🤔. I decided to dive into the deep ocean of the internet,on my quest to find a suitable framework that suits my criteria. Which are:consistency,Flexibility,Extendable functional core,Fast learning curve,Popularity, just to name a few.
In my quest I found a few php frameworks that managed to tick the boxes Just right, they were symphony,CakePHP,codeIgniter and Laravel. Of this four frameworks I found Laravel to be the most seductive.Why?🤷🏾♂️, it’s syntax is so easy to learn,it has a vibrant community,it’s ORM (Eloquent) is a fantastic,it comes with its own command line(artisan) out of the box ,it’s super flexible and it’s quite Versatile!!!. I really enjoy coding in Laravel.
Most of the time,when i try something new in Laravel, I usually just end up saying, “... and it just works.
How it works.
Well up until now I’ve been talking about only the abstract stuff. What about the code,You may ask ?. Let’s write a dig into some code, so you can see what it looks like.
<?php
Route::get('/', function () { return 'Hello, World!';
});
The simplest possible action you can take in a Laravel application is to define a route and return a result any time someone visits that route.
If you initialize a brand new Laravel application on your machine, define the route in The example below, and then serve the site from the public directory, you’ll have a fully functioning “Hello, World” example see below.
Hello, World!
Although,In this tutorial. I’m not going to be diving into much code. If you want dive deeper check my next tutorial for how to get started.
So in the long run,Laravel brings your ideas into a reality with no wasted code, using modern coding standards, surrounded by a vibrant community, with an empowering ecosystem of tools.
And if you, dear developer, deserve to be happy Laravel does just that 😁.