Today I will share with you a detailed comparison of the laravel framework and other frameworks. It has a good reference value and I hope it will be helpful to everyone.
Advantages: (Recommended learning: laravel development)
1. The code is relatively clear and easy to understand. It is similar to an English sentence. The keyword is function. For example, get all the data of a table in the database:
$article=new Article; $articles=$article->all(); //这样就得到了articles表所有记录的所有字段; $count = $article->where('class_id','=', 1)->count(); //是不是一看就明白了意思?查找分类id为1的记录,并计算出个数。
There are too many such examples. Here are two examples.
2, The documentation is very rich, and the community is also very active. It now has the highest share in the world, and basically all questions can be answered;
3,A large number of third-party open source libraries (more than 5,500 packages included in composer) can quickly and conveniently implement module functions. Excellent third-party packages officially have detailed user manuals. For example: laravel/collective
4, The security mechanism is very complete, the data verification of the submitted form (there are almost 80 types of verification, basically everything you can think of), random_ is generated when submitting the data Token verification can avoid illegal submissions and avoid cross-domain attacks;
5, middleware and routing, filter and control access, and determine the legality of requests before calling function classes and methods. safety to avoid illegal requests;
6, The error handling mechanism is simple and easy to use. If an error occurs, just call $error->all() to output all errors, especially for form verification. Easy to use;
Disadvantages:
1. Slightly complicated and slower to get started than ordinary frameworks;
2. A large number of third-party references package, but we only use some methods in the class, and the code seems a bit redundant;
3. The performance is slightly better than that of general frameworks, but it is less efficient than small frameworks such as yaf.
Summary:
Laravel is a young framework with the largest number of users in the world. It has complete documentation and a large number of excellent third-party packages for reference. It is suitable for large-scale website collaboration. development. Regarding the performance issue, let me tell you my own opinion. The bottleneck of the web system developed by PHP is generally not at the execution level of the language itself. The time consuming of language execution only accounts for less than 1% of the entire system. The main time consuming is in the network. communication.
Comparing the efficiency of native PHP and PHP under the framework, we can only say that the usage scenarios are different. The output of hello world from native PHP is hundreds of times faster than using a framework, but the framework is not used to write hello word.
The above is the detailed content of The difference between laravel and other frameworks. For more information, please follow other related articles on the PHP Chinese website!