Home >PHP Framework >Laravel >What are the disadvantages of laravel

What are the disadvantages of laravel

青灯夜游
青灯夜游Original
2022-02-14 13:58:284674browse

The disadvantages of the laravel framework are: 1. It is a component-based framework and is relatively bloated; 2. The framework is large and less efficient than small frameworks such as yaf; 3. The framework is complex and it takes more time to get started than ordinary frameworks. Slow and high learning cost.

What are the disadvantages of laravel

The operating environment of this tutorial: Windows 7 system, Laravel 6 version, Dell G3 computer.

laravel framework

Laravel is a simple and elegant PHP Web development framework (PHP Web Framework). It can free you from messy codes like noodles; it can help you build a perfect network APP, and every line of code can be concise and expressive.

Advantages

  • Rich documentation

  • A large number of third-party open source libraries

  • Complete security mechanisms (form verification, etc.)

  • Middleware and routing filter and control access to avoid illegal requests

  • Friendly error handling mechanism

  • Support composer package management tool

  • It integrates PHP’s relatively new features and various design patterns.

Disadvantages:

  • Based on component-based framework, relatively bloated

  • The performance will be lower than that of small frameworks such as yaf

  • It is more complex, slower to get started than ordinary frameworks, and the learning cost is high

Benefits of Using the Laravel Framework

If all of the above sounds interesting enough to encourage you to use a framework when developing your next application, then here’s what’s next Let me share some advantages that Laravel framework has over other PHP frameworks. These advantages undoubtedly make the Laravel framework one of the top contenders for the best PHP framework.

1. Out-of-the-box user authentication

The Laravel framework provides out-of-the-box user authentication functionality. Any modern web application requires user authentication, and using the Laravel framework, you barely have to do anything to set it up. When you set up user authentication, the Laravel framework creates all the important components such as the user model, registration and login controllers, and corresponding views. And in the future, it will be very easy to extend these components to newly added functionality based on the business logic required by the application.

In addition, the Laravel framework also provides the Socialite package (extension package), which enables your application to authenticate users using various social networks (such as Facebook, Google Plus and Twitter). To make it work, you only need minimal configuration.

2. Convention over configuration (also called programming by convention)

The Laravel framework also adopts the "convention over configuration" approach. This basically means that if the naming conventions for the different components are followed, there is little configuration effort to worry about. If you follow the naming convention, the Laravel framework itself will take care of a lot of the low-level details for you, and everything will magically start working. If you've been programming in traditional PHP, this might feel overwhelming at first. But once you get a taste of it, you'll never want to look back.

3. Easy-to-use email functionality

It’s hard to imagine a modern application without email functionality. Implementing email sending functionality is very easy using the Laravel framework. In addition to SMTP and Php mail functionality, the Laravel framework also supports a variety of email notification services such as Mailgun, Mandrill, SparkPost, Amazon SES, SendMail, and more. These services allow you to quickly start sending emails via local or cloud-based services. You can also use Nexmo to send notifications via Slack and SMS. All these services are available out of the box in the Laravel framework.

The Laravel framework also supports Markdown in email templates (Translator’s Note: Markdown is a text-to-HTML conversion tool), which allows you to complete it in very little time Email creation work.

4.Artisan Command

For me personally, the Artisan command line is the most concise and useful function provided by the Laravel framework. Artisan is a command line interface for the Laravel framework that helps developers automate many tasks using the command line itself. Artisan commands can be used within the application itself, or developers can create additional Artisan commands.

For every common task you can think of, you can find an Artisan command corresponding to it. For example, create a model, create a controller, create a database seed, migrate the database, etc. The list is endless. I say it's "concise" because all you have to do is pass the command and the Laravel framework takes care of the rest.

5. Test automation of “test-driven development”

The Laravel framework comes with support for PHPUnit, making it very easy to test PHP applications using the "test-driven development" model. It becomes easy to write unit tests for your application and ensure that things work the way you want them to.

6. Clean Dependency Injection

Once you start working with the Laravel framework, you will quickly realize that the Laravel framework is derived from Ruby on Rails and more Get inspiration from functional languages, not from Java. This can be easily seen from the way the Laravel framework handles dependency injection. Although implementing dependency injection can take complex patterns, the Laravel framework takes the opposite approach and provides a simple way to create global helper functions. With the help of global functions and Faade static proxies, we can easily implement dependency injection wherever needed.

7. Separation of business logic and display code

Laravel follows the model-view-controller (MVC) architectural pattern to separate business logic from views. This approach has many advantages. To truly understand its benefits, you need to understand what the MVC pattern is and whether your application requires such an architecture.

8. Eloquent ORM (Object Relational Mapping) Implementation

Eloquent is the ORM (Object Relational Mapping) implementation provided by Laravel. For more information, refer to the link in Wikipedia (https://en.wikipedia.org/wiki/Object-relational_mapping). Eloquent makes it very easy to get data from the database. It also becomes simple to create relationships between tables and get data from these tables. Eloquent also allows you to create various connections to your tables and provides many helper functions that make interacting with the database very simple. You rarely have to write SQL queries or functions. Because of the Eloquent ORM, the Laravel framework can provide out-of-the-box support for the following databases:

MySQLPostgreSQLSQLiteSQL Server You are so right, this basically means that as long as you use Eloquent, you don’t have to worry Compatibility with any of the above databases. It's also very easy to switch from one database to another. Now try to imagine the scalability this brings to your application, let me explain this with an example. Let's say you have an application that starts out with a small user base. Since the number of users is small and the application is in its infancy, you decide to use MySQL as the database. After some time, the number of users of your application grows to a considerable level, and now you may need to switch to a SQL Server database. Because of using Eloquent, this switch is now as easy as changing specific configuration details in the Laravel framework.

9. Queue and Scheduler

When developing applications, there are usually some time-consuming tasks. These tasks need to be deferred to a later time so that they do not block the user's flow. A perfect example of this type of task might be generating a PDF report that counts user requests to create a CSV file. The Laravel framework's queue service provides a unified API for deferring these tasks to a later time in the application.

Talking about the Laravel framework's command scheduler, it is the perfect replacement for those cumbersome scheduled tasks (Cronjob). Many times, developers have to set up scheduled jobs for specific tasks. A perfect example of this kind of task is to send all subscribers a weekly newsletter (Newsletter) to which they subscribed. In order to set up this cron job, the developer must log into the server using SSH commands and set up the cron job at the operating system level. This can become a problem over time because these cron jobs cannot be part of the management of GIT and other version control systems. But the Laravel framework's command scheduler provides a clean API using built-in functions to schedule a variety of tasks. This way, you don't have to use SSH commands to log into the server's terminal, and all these scheduled jobs become part of the code and are included in the scope of the version control system.

10. Simple routing

The way the Laravel framework handles routing is simple and intuitive. There is a single web.php file that handles all web routing. If certain routes require common middleware, they can be easily grouped in Laravel.

A perfect use case for routing is some pages in your application that require user authentication before the user can view them. The Laravel framework can group all these pages, and they are checked by Auth middleware to ensure that only users logged into the system can view these pages. The Laravel framework also provides a concise route model binding, where models can be bound to routes. With this help, the view can be returned directly from the route itself without even needing to access the controller.

11. Composer manages dependencies

The Laravel framework uses Composer to manage dependencies and autoload. Composer helps you install Laravel extension packages, which makes dependency management a breeze. At any time, you can check the package.json file to see all the dependencies your application is using. Composer also enables you to update dependencies using a single Composer command.

12.Blade template engine

Blade is the template engine of the Laravel framework. Blade gives you a head start in separating views and business logic. It keeps your view code very clean. Once you have a clear understanding of the MVC architectural pattern and Laravel's implementation of it, you will understand more clearly the importance of the Blade template engine. Blade also provides template inheritance, so you can divide your most recently used template into parts and have other view files inherit those parts. With the help of Blade, you can create logically smaller parts of a view that can then be included to form a complete view.

13. Documentation

This is a bit of a gray area. When I first started using the Laravel framework, I really had problems finding documentation. It was all undocumented, but at a certain point I suddenly noticed that something started to work magically, and that's when everyone started following naming conventions. Now, there are API documents that list every class and method declared in the Laravel framework. Once you get the hang of it and know how to use the Laravel documentation to your benefit, I guarantee you won't have any complaints again.

14. Active Community

Laravel does have an active community. When you encounter any problem, you can search and you will surely find many StackOverflow posts for your problem. In addition to an active community on StackOverflow, there is also a discussion forum called Laracast. You can sign up for free to be part of the Laracast forum and community, which is very active right now.

I think these advantages are enough to get you excited about the Laravel framework. Although defining it as perfect is definitely an exaggeration, I can definitely say that the Laravel framework is definitely one of the best PHP frameworks.

Related recommendations: The latest five Laravel video tutorials

The above is the detailed content of What are the disadvantages of laravel. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn