fbpx

What is Laravel framework, and why is it so popular?

Valerio Barbera

Hi, I’m Valerio, Software engineer and CTO at Inspector.

If you are a developer, you’ve probably been pushed by everyone to learn a framework to develop your applications.

But in every developer’s journey comes the moment to take a decision. It’s almost always the same moment we finally find the business idea we want to dedicate all our effort.

This choice is never easy. The main reason developers get struggle thinking about a framework is the fear of being conditioned in the future.

Adopting a framework instead can lead to great results, and can give you the ability to build assets that can lead you to professional success.

What is a framework

For a developer, the most valuable asset is to define a process.

Try to imagine how much easier your job would be if you had a clear, defined method to develop your applications that is repeatable and even automatable.

The advice I repeat every day to my collaborators is:

Stop looking for tools or libraries to write less code. Instead, find a design that can help you to define the right process to solve a specific issue in a long-term way.

Think about the word “framework”. It consists of two words: “frame” – “work”. It’s like an organized work scheme. So each framework is like a proposal, that’s why you can prefer Symfony instead of Laravel, because their organizational foundations are different based on the challenge that the community has faced over time.

Anyway these organizational proposals are the results of the work of many experienced developers.

Say no to a good framework is like saying no to an international team of experienced developers who make applications for successful businessess. They give you advice on how to reach your goals and you say no… Be careful?

For example, if you spend time studying how to handle authentication using a framework instead of coding it from scratch, it doesn’t mean you’re wasting your time, because you will never be able to do it in a repeatable way or without errors.

The first step is to understand that start with a framework is not an admission of ignorance but rather a wise way to reach our business goals as quickly as possible.

What is Laravel and why it is used?

Help developers simplify their development process with clean and reusable code is the claim of every framework. So the real quistion should be how Laravel accomplish this mission better than any other framework out there.

Easy to use

Tayor Otwell and his community, developed Laravel focusing their attention on wrinting fluent, clear, and natural to understand code APIs.

Classes and methods name are always clear in their purpose and also the namespaces and framework organization appears so clear and familiar from the first day.

Simplicity is a feature that has always guaranteed great results in the technology space. But it takes a lot of effort to achieve it. Laravel has also a fantastic documentation portal that surely costs a lot of time to be maintained and updated over time.

Availability of Pre-built Components

Inside Laravel you have a lot of infrastructure functionalities ready to use by default.

Its driver based architecture helps maintainers and users to continuous adjust and expand framework functionalities and integrations.

From basics components like the template engine, routing, Log management, Eloquent ORM, to advanced modules like Filesystem abstraction, Redis client, and the powerful Artisan console or the Jobs/Queues system.

Regarding in particular the queuing system with the version 8 of the framework it introduced some features that you can find only in commarcial licensed solution in other environment.

The components ecosystem consist also in a set of official packages to address some common use case developing a cloud application like Passport as the official OAuth server, Socialite to provides social authentication to your users, Horizon to watch inside your Redis queue system, Cashier for billing and many more.

Laravel Validation

I would reserve a special mention to the Laravel validation system that is one of the best example of the Object Orientend mindset with which Laravel is developed.

Next to a lot of predefined validation rules, you can build custom validation rule as reusable class.

As an example I developed an email validator that check an email through the ApiLayer API to avoid registration by spam email address in my app.

Here is the validation rule class:

class EmailSpamChecker implements Rule
{
    /**
     * @var Client
     */
    protected $http;

    /**
     * Create a new rule instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->http = new Client([
            'base_uri' => 'http://apilayer.net/api'
        ]);
    }

    /**
     * Determine if the validation rule passes.
     *
     * @param  string  $attribute
     * @param  mixed  $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        try{

            $response = $this->http->get('/check', [
                'query' => [
                    'access_key' => config('services.mailboxlayer.key'),
                    'email' => $value,
                ]
            ])->getBody();

            $response = json_decode($response, true);

            return $response['format_valid'] && !$response['disposable'];

        } catch (\Exception $exception) {
            report($exception);
            return false;
        }
    }

    /**
     * Get the validation error message.
     *
     * @return string
     */
    public function message()
    {
        return 'Invalid email address.';
    }
}

That you can easily use in your controllers:

return Validator::make($data, [
    'name' => ['required', 'string', 'max:255'],
    'email' => ['required', 'string', 'email', 'min:5', new EmailSpamChecker()],
    'password' => ['required', 'string', 'min:6', 'max:20'],
]);

Optimized for security out of the box

Application security, or system security in general, depends by developers best practices and experience. Anyway Laravel helps developers to avoid a lot of risks based on common security vulnerability, probably the best PHP framework in this field, thanks to its built-in protection features like security against cross-site scripting, SQL injections, cross-site request forgeries and more.

A solid company behind

One of the most undervalued aspect talking about Laravel is the solidity of the commercial products ecosystem that the Laravel team created in the last few years.

This aspect could sounds off topic related to an open source project, but I really believe that it is totally the opposite.

With a commercial ecosystem Laravel founders have built the right foundation to ensure a stable future and a long-term perspective for companies and developers that rely on Laravel to develop their business.

Real-time monitoring

Laravel provides really solid bases to build great softwares, but despite this when the application starts to serve real users errors, mistakes, and performance bottlenecks can become the enemy for our business grow.

Many of us continue to discover bugs and errors in the applications thanks to direct reports by users.

It’s too dangerous, because when a user reports a problem it’s just too late. For a user that report a problem there are many others that simply stop using our application silently, moving to another product that fits their needs better.

That’s why we introduced Inspector, the Laravel real time monitoring dashboard ready to use in less than one minute.

If you want bring real-time monitoring power in your Laravel application you can read our quick start guide: Laravel real time performance monitoring

How to use Lavarel Orm

Database is a shared resource used by all processes that runs in your application. Even just one poorly designed access can hurt the performance of the whole system.

Learn more on how to optimize the ORM performance in a Laravel application.

Laravel performance metrics

Anyone that has ever made a decision uses or has used averages. They are simple to understand and calculate.

But although all of us use them, we tend to ignore just how wrong the picture that averages paint of the world is.

At this link I talk about actionable metrics I use to make informed decision avoiding unecessary risks.

E- commerce monitoring

As you probably know Laravel is widly used as basic infrastructure to build great e-commerce platform.

Thanks to its Laravel foundation Bagisto is a perfect example of how developers can enjoy the ready-to-go Inspector experience, integrating a real-time monitoring system in less than one minute.

How to monitor a Bagisto e-commerce in Real-Time using Inspector.

Laravel custom monitoring strategy

To help you get faster in identifying which part of the application is in trouble, we have designed an easy and ready to use way to directly monitor your application controllers and methods execution.

Learn more on how to implement this custom strategy.

Avoid MySQL race condition

Laravel provides a really great architecture for background Jobs and Queues.

They introduces parallel tasks execution in your app that is one of the most interesting field for any developers committed to scale your app keeping server resources cost-friendly.

One of the most annoying side effect of parallel jobs execution is database race condition. Learn more how how to avoid database dead-lock.

Related Posts

Application performance monitoring tools 101

Responsible for the performance of your company’s IT operations? Read this guide to find out if you could benefit from application performance monitoring. Hi, I’m Valerio, software engineer from Italy and CTO at Inspector. In this article I reported my experience working on develop large applications, and how monitoring cames in my journey when I

How to turn a credentials breach in a development opportunity

Hi, I’m Valerio founder and CTO at Inspector. Recently my personal account on one of our company’s tool was cracked. My credentials have been stolen so the attackers have had access to this service with our credit card attached. There were no risks for our users security, but only for our bank account, because attackers could

Support for multiple URLs in Webhook Notification Channel

Hi, I’m Valerio CTO at Inspector. As integration becomes increasingly central to the way that our customers automate their internal process, we have recently released a new feature for our Webhook Notification Channel. Before Before this product upgrade you could configure the URL of the external system to which you wanted to send the notifications.

Stop losing customers and money
due to technical problems in your applications

Monitor performance of your code execution in real-time and identify bugs and bottlenecks before your users do.
2020 © Inspector S.R.L - VAT: 09552901218