Where is laravel elegance?

Source: Internet
Author: User
It's all about laravel's elegance. I 've found wireless pains over the past few days. It's full of anti-humanity and non-human nature. Isn't it possible for programmers to have a user experience, each time a controller is added, a route is added. Let's talk about routes first. Let's talk about other routes first. Where is his elegance. Let's give an example of laravel's power. Don't always say that laravel is good and composer is good. For example, from the perspective of a project, what functions are used to implement a specific function, the advantages of these writing methods, and post-maintenance. It's all about laravel's elegance. I 've found wireless pains over the past few days. It's full of anti-humanity and non-human nature. Isn't it possible for programmers to have a user experience, each time a controller is added, a route is added. Let's talk about routes first. Let's talk about other routes first. Where is his elegance.
Let's give an example of laravel's power. Don't always say that laravel is good and composer is good. For example, from the perspective of a project, what functions are used to implement a specific function, the advantages of these writing methods, and post-maintenance. Reply content: read the document and you will know the code writing method that conforms to human thinking. I used it to write the project, and later the company's IOS itself was modifying the code. He does not know PHP, but of course he does not make much changes.

In fact, there will be another problem: I can't understand it when I look at its documents that are unfamiliar with php, and then I will say it is not good, so for beginners, its documents are not foolish enough, unlike the domestic framework, it's just a fool to teach you how to write it step by step. Haha...
Let me talk about your so-called anti-virus route mechanism ..
I don't know what else can be more elegant in addition to the manual method for mapping path and behavior.

In your opinion, the ideal state is to add a controller to define an action and then automatically mapping it to the route. Yes, it is effort-saving for writing CRUD, but it is not elegant to be lazy. You will say that the framework is used to save the workload. What's wrong with laziness? Then you are wrong. The framework is used to make the project more elegant, not to be lazy.

Then I will say that route is the elegance of manual configuration.

1. You can write a set of automatic controller, route, and mapping modules by yourself. Yes, you can write it by yourself, because the route file is a php script file, you can call anything you want. Then, if you want to be lazy, you can easily solve it yourself.

2. callback: make proper use of the callback feature and make unlimited use of it.
3. Under proper management, the routes. php file is an awesome entry to research code. You can easily find the controller or callback of the corresponding URL. Clean and clear, this is called elegance.


After route, let's talk about the whole thing. The bottom layer uses the symfony2 things. Configure the composer for what to use. If you don't need it, you don't need to use it. So here comes the elegance. I think it's awkward to use the ORM module, so I don't need to use it anymore... It's awkward to use Http... Write it all by yourself .. This is elegant and low coupling. A good framework is like this.

Then let's talk about some non-elegant frameworks ....

$ _ C and C ()

I will not talk about anything else .. It is very characteristic to learn from and use such advanced tools and ideas on the market. There is no "Elegance" left. Thank you. Laravel emphasizes Artisan, a craftsman. The craftmanship of the craftsman must be elegant and exquisite. So the so-called elegance refers to the neat, easy to understand and easy to manage code;

First of all, it is easy to understand. If you are familiar with English, you will gradually know that Taylor is a person with a high level of language. Laravel's word itself sounds like a hot name.
The so-called "easy to understand" means that you can understand the meaning of the code without reading comments, and the code is very simple and reusable;

Code chaos easily occurs in the controller section. Let's look at an example. It's easy to get some data from the home page:

Public function index () {$ categories = ['newbie ', 'instance', 'plug-In', 'advanced ']; $ posts = Post: with ('category ') -> whereHas ('category ', function ($ q) use ($ categories) {$ q-> whereIn ('name', $ categories );}) -> orderBy ('created _ at', 'desc')-> simplePaginate (7); $ tags = Tag: all (); $ most_read = Post :: orderBy ('clicks', 'desc')-> with ('category ')-> take (5)-> get (); $ feature_ids = Settings :: get ('features '); foreach ($ feature_ids as $ key => $ val) {$ feature_posts [$ key] = Post: findOrFail ($ val );} return view ('front. index', compact ('posts', 'tags', 'most _ read', 'feature _ posts '));}
If you don't want to talk about it, let's talk about route. I don't know which version you use, Laravel 4 .*? Have you tried group, before, and after filter. Laravel 5? Try Middleware? Is RESTful used? Let alone how convenient it is to use Route for SEO.

I don't know how easy it is to use Composer. It is easy to manage and expand. Alas, I used a lot of frameworks. At last, I realized that using PHP echo statements is the most elegant. Simple is beautiful! Many frameworks are over-designed. This is a sad framework. I deeply feel that this framework is a malicious comparison between new users and Phalcon. Looking at Laravel, we have not found any enterprise-level applications that are elegant, complicated, bloated, low-performance, and not suitable for high-traffic applications. Why do I think the subject is very human and easy to understand.

It can't be said to be easy to maintain...

Isn't it laravel of a planet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.