Skip to main content

Usually back-end web developers will involve more on the UI and visual aspects of the application. Therefore, they have to pay attention to different segments of the application, instead of focusing on their primary objective. However, if you want your developers have better focus on the quality of your code, you need to separate the back-end API strictly from the UI.

With Laravel, you will no longer experience a lack of functionality or awkward approach to some problems which you may find in other framework, such as Yii, CakePHP, Codelgniter, Slim Framework, Symfony, and few other open source frameworks.

This is why:

There may be more or less function that Laravel could offer you, but here are several functions of Laravel.

  • Quick and functional core that can be extended
  • Clean and simple routing
  • Effective ORM and database layer
  • Easy integration with third-party libraries (AWS, export libs, etc.). You can use Composer or Packagist to include libraries in your project.
  • Active and growing community that can provide quick support and answers.
  • Supporting unit tests out of the box
  • Async queue and background jobs for the long running tasks

Laravel Core and Routing

You can learn about Laravel kernel on GitHub which is allowing customization and rewriting of any part of the framework by implementing an IoC pattern through request, logging, authentication, etc.).

However, you need to find other frameworks as Laravel designers didn’t spend too much time reinventing the wheel for example is Artisan, the extended Symfony console which is a command-line interface included with Laravel.


You may find that Routing in Laravel is very similar to the Ruby on Rails (RoR) implementation since it is easy to group routes, create resources for CRUD pages, attach filters and automatically bind models to the request parameters.

Nested routes are a very useful feature:

Route::group([‘prefix’=>’level0’], function(){
Route::get(‘/’, array(‘uses’ => ‘TestController@level0’));
Route::group([‘prefix’=>’/{level0}/level1’], function(){
Route::get(‘/’, array(‘uses’ => ‘TestController@level1’));
Route::post(‘/{custom_variable}/custom_route’, array(‘uses’ => ‘CustomConroller@custom_route’));

Versioning is when you want to update your data by using the ‘v1’ prefix, but we still can retain the old one and use the ‘v2’ prefix change the API version even when we change the API version, to start implementation of routes with new code and logic, i.e., new references to controllers and actions.

Let’s take a step-by-step look at everything used in this Laravel tutorial:

If we have a call BASEURL/level0, then Laravel will resolve it and call method level0of TestController to process the request.

We have a sub-group with the {level0}/level1 pattern. We should use the path for the parent group (level0) to access API resources inside this group and match the pattern of our sub-group ({level0}/level1). For example, level0/777/level1 is the correct path for this sub-group of our API. Here we have 777 as the variable level0 that Laravel will path to the handler of the routes inside the sub-group.

Laravel uses Eloquent ORM

Another advantage of Laravel is that is can perform flawlessly since it works based in Eloquent ORM. In addition, it can be used with PostgreSQL and MySQL very well.

Query Scope-query logic is created as a function with a special scope prefix. The following example shows the standard SQL Query transformed to a query function in Eloquent ORM:

SELECT * WHERE hub_id = 100 AND (name LIKE `˜%searchkey%` OR surname LIKE `˜%searchkey%`):

function scopeByFieldListLike($query, $fields, $value){   
$query->where(function($query) use ($fields, $value){       
foreach($fields as $field){           
$query->orWhere($field , ‘like’, “%”.$value.”%”);       
return $query;


Using a function in your code is straightforward.

$model = new User;
$model->byFieldListLike([‘name’, ‘surname’], ‘searchkey’);

A lot Eloquent methods return an instance of the QueryBuilder. You can use almost all of these methods on models.