How does it feel to look at Laravel's PHP framework?

Source: Internet
Author: User
Keywords Laravel composer
Tags php excel drupal
I heard that laravel quite fire, with a look, did not go in-depth to see, only after reading a quick start, after watching a little lost interest, special to know to ask. If this thing is to use composer way into a variety of third-party packages to complete the task, then the flexibility is not too low a bit, although not repeatedly built wheels, but finally everybody out is the same wheel, there is security good guarantee, heard the efficiency is not high AH. How much development speed can be accelerated without the use of third-party packages? Would it be worse than the other frameworks?

Add: Some answers think I laravel not enough in depth so evaluation is not objective, OK, I think this is also possible, although the first sense is not good, but in order not to make arbitrary conclusions, I decided to continue to go further, if not good, then come back to refute you, hem, =p.

Reply content:

son of Wucheng, smell the sound of xiange. The teacher smile and laughs, Yue: "Cleaver". ---The Analects of Confucius
We learn a framework not because he is easy to learn, but because he is efficient and powerful.

The advent of the Laravel framework brings PHP back-end development to a new height, with the composer and php-fig, and so on, marking that PHP is no longer just "front-end language", "Presentation layer language".

PHP features is easy to get started, and PHP is a big grammar, a compilation of C Perl and so on, when I learned a half day, you can take to do the site.

For frames, most phper will prefer thinkphp or CI. Because the threshold of these frameworks and the threshold of PHP very well. If, like Java, study half a year to do development, most of the phper is not acceptable. If a framework (such as SSH) need to learn half a month to get started, Phper can not accept, so TP and CI framework is very much the way. (The PHP and SSH framework of the same ZF has been phper despised as big and useless, everywhere to reveal this Java odor)

With the advent of Laravel, I did not hesitate to transfer from CI to the Laravel camp.

If you are just for the customer Write a website, then even the native PHP can cope, if you want to improve a little more efficiency, you can choose TP or CI.

However, if you are developing a project for the company or yourself, this project is prepared to operate for more than five years, then the disadvantages of CI will be highlighted. In five years, CI estimates have been upgraded to the N version, PHP has also upgraded the N version. Do you upgrade?

The project is in the local development debugging complete, when on-line after encountering the problem, how do we find, how to track it? The most common way is log. Now almost every frame has a log function, but Laravel's other strength is that his log follows Php-fig, which means you can change the log implementation class at will to improve performance. This is like our PC, which has USB Interface, so that we can replace the USB device, such as USB mouse, USB keyboard, USB hard disk, etc. While Laravel provides log interfaces based on the Php-fig standard, we only need to replace the implementation.

So here's the problem, Excavator ..., now a lot of PC support USB 3.0, at this time, we buy hard disk when we can buy support 3.0, in order to achieve higher speed. Laravel using composer Management Package Dependency
If this thing is composer in a variety of third-party packages to complete the task, then the flexibility is not too low a bit
Use of composer is not intended to Transfer in, but for management, Management Packs, and versions of various packages。 This solves the compatibility problems of various packages. Before the advent of composer, PHP still had no effective way to solve these problems. If we need an Excel import and export function, we will go to search PHP Excel library, most of the situation is to download the latest stable version of the official website. If there is a problem, go to Google or Baidu search, "I go to the original version of the problem, the library uses anonymous functions, PHP 5.3 does not support, hey, can only download the previous version of ~ ~".

Composer The idea of engineering into PHP

How much development speed can be accelerated without the use of third-party packages?

If it is only Development Speed, Laravel is undoubtedly inefficient and cumbersome. This is clearly not matched with "the best language in the world". But if you have developed large and medium-sized projects, you will find that coding (Coding) is not even one-third in the entire project phase. 10,000 steps back, the development cycle may be 3 months, but the entire project life cycle is indeed 3 years ah.

If your trip is 10 kilometers, then undoubtedly driving is the fastest, if the plane, it is estimated that there is no time to take off. If the trip is 100 meters, walking is undoubtedly the fastest.

Another problem that is ignored by Phper is unit testing. The same is the MVC framework, but many of Phper are designed for MVC and MVC, for design patterns. Know it but do not know why. If you ask a phper why you use MVC, why use patterns, most of the estimates are not answered.

This afternoon also in the SF saw a similar question, to the effect of thinkphp model what is the use of the code can be written in the controller, so fast. Admittedly, most phper do not know why a layered architecture is used, even if it is using a framework.

When it comes to layering, any Java framework can throw PHP a few blocks. (PS: I can see from my name, I am Java powder, but I also believe that PHP is the best language in the world)

Now there is a controller that handles transfers. In this process, form validation is required, the controller processes the business logic, persists (stores to the database), renders the view, and has some security processing, logging capabilities, and so on.

In the traditional PHP development process, are: coding, running, debugging error, until the success of the run, and then open the browser, input data, click to execute, see the results, if correct, re-enter the data, if the error, modify, debug, then open the browser, repeat, repeat, know their satisfaction so far.

We can also use the PHPUnit, we write the transfer function into a separate class (several), testing the core function of the transfer. But we want to test the controller, the model, but also need some black magic. If you are in SSH, then easy, any module can be taken out separately for unit testing. Because any one module can be run independently of the SSH framework.

In SSH, we can take the controller out and put it in JUnit to test the function of the controller. We can also take out the router module and test if the URL is routed correctly. Wait a minute. In the PHP CI or TP framework, the controller can not be taken out alone to test.

and Laravel's other contribution to the engineering of PHP is-- testability。 The amount ... The amount ... The amount ...
PHP finally have composer, you actually say this goods useless? The purpose of the framework is to project sustainability, not how quickly a project can be developed.

In this age of iterative renewal, there is no sustainable architecture, it is useless.

If your system has hundreds of functions, each feature has a certain dependency, in addition to package management, what good way, let hundreds of people team to develop in order? It is highly recommended to learn laravel, and you will find that in the learning process you will learn more about the outside of the framework
1. How to turn the wall, because the composer of the installation and use of the speed inside the wall is outrageous
2. How to translate, because Laravel's documents are mostly in English, such as laravel5.1 was released in June, until today October 19, the complete Chinese document is still not.
3. How to tear force, you want to opposite the person with TP do not understand, with yaf people's contempt, with Yii people's Temptation of the eyes
4. How to operation, after the project on-line, facing the problem of low performance you need Redis memcache Opcache php7 HHVM and so on to optimize the performance of the scheme

Above! First of all, I personally like Laravel. However, I do not think it is necessary to myth laravel.
Slowly more ... Well.
/**********************************************************************************/
Composer
Just to make it easier for you not to reinvent the wheel, it doesn't really have anything to do with Laravel.
Laravel just can use composer. You can also use composer without laravel.
For example, CI3.0 supports composer, even you can use composer without a frame.
Composer's features and Laravel's characteristics are fine.

composer and Laravel do not hinder the freedom of your project code.

Is there a bug in the core business, the core data-related components,
Do you have to wait until the composer update version to fix the bug?
Of course not ...
Laravel, can't you write an include to introduce a file, a new object?
Of course it's not ...

The existence of a framework does not reduce the degree of freedom you write code.
And just provide you with a specification:
Write in accordance with this specification, you can enjoy the benefits of this specification,
And naturally also bound to be bound by the norms, to withstand the disadvantages of norms.

/**********************************************************************************/
It's not totally pointless to make wheels again.
-Even in a work project.

Most of the time, the wheels that can be found are not suitable,
In this case it is necessary to transform the wheels and even to redo the wheels.
It's a normal thing, and there's no need to be afraid to reinvent the wheel.

Of course, be sure to evaluate the pros and cons of using old wheels, retrofitting old wheels, and re-doing new wheels,
Weigh the pros and cons before making a decision.
/************************************************************************************/
Laravel's unit test concept, as @justjavac says, is really good.
This is indeed a very attractive place for laravel!!!
But if we say that because Laravel supports php-fig or JUnit, we need to support it.
It's really a different project to look at ...
Choosing the right framework for your project is more meaningful than a frame of death.

As for the big project ...
How many PHP projects exist that last more than 5 years, with a single system maintainer of more than 100 people?
I guess not a lot, huh?
I am exposed to a large project of a single system that is very rare,
More is the project where n small subsystems coexist.
And such a project if shaving unit testing and other advantages ...
How many advantages does Laravel have? The feeling is not too obvious ...
[Of course, it may also be that I have not been exposed to enough "medium-sized projects" for reasons ^_^]
/*****************************************************************************************/
LARAVEL and CI give me the Feeling:


CI3.0 like a toolbox. I can easily find the tools to use. Through the tool in the toolbox, I can also process a lot of handy gadgets to use.

LARAVEL like a lathe. The speed of tools and tools that lathes can manufacture is not comparable to the toolbox. But if you want a lathe to make the tools in the toolbox, the strength you need is not a tool box to match. Feel your needs and abilities with Laravel provide value not on a bit laravel design ideas are very advanced, ideal for application of various development patterns TDD, DDD and BDD as a framework, it prepares you for everything ~~composer is simply a future of PHP, No composer,php must go to the decline ~ ~
For beginners, the beginner is not very high, especially the new Laravel 5, but the learning value is very high ~ ~ you want to know the latest in the PHP industry programming thinking, learn Laravel bar larabase--All-stack engineer House In fact, a lot of things are not complicated, afraid of the complex theoretical content. A lot of things once you've figured it out. Many people think laravel this is not good, it is difficult here, I can only say, Laravel is not a first-class and excellent framework. Laravel's greatest features and excellence are the collection of PHP's new features, as well as a variety of design patterns, IOC containers, dependency injection, and so on. So Laravel is a framework for learning, he and other framework ideas are very different, this also requires you very skilled PHP, solid foundation. If you think Laravel is difficult then the reason is only one of you PHP Foundation is not good enough.

In addition, being good at using namespaces and object-oriented features to pursue something, you will find it all so easy. Anything exists there is a reason for its existence, not a stick to kill, should take its long complement its short look at the Routing and ORM part, and the front end of the combination of backbone such as should be very fit, or very good, and the other composer is a very good thing, about efficiency issues, The efficiency of Web programs is never the framework, and in the database, the framework that consumes a little bit is not a burden at all.

To add, it is not entirely correct to say that the consumption of the frame is negligible, there is a wonderful, once used Drupal two times a simple list page to consume more than 20 m of memory, because the configuration of Drupal itself is too complex (not my configuration complex, but the system itself complex), For maximum freedom of content configuration, what variables are plugged into the page. Go to StackOverflow asked, get the answer is Drupal in this is normal. Drupal is generally a framework, but this framework with a CMS system, of course, such a system must be a series of optimization to use.

Laravel framework is pretty good, can be said to be very comprehensive, with the development of Phpstorm is very happy.

Share two sets of instructional videos yourself from / http laracast.com Previous one dragged down, no subtitles.
Laravel-whats-new Link: Baidu Cloud Please enter the extraction password Password: 6cwy
Laravel-fundamentals Link: Baidu Cloud Please enter the extraction password Password: aw2h

There is a phpstorm use experience to share, if also use sublime even zde friends as soon as possible change phpstorm it, can say sublime function it all have, but also have some advanced IDE function, in addition, even vim users should try, Phpstorm has plug-ins that can simulate Vim's operation and enjoy other benefits.
How-to-be-awesome-in-phpstorm Link: Baidu Cloud Please enter the extraction password Password: Hgga I have observed a phenomenon: developers who often find laravel difficult to learn and useless will only have PHP in one language, or the vast majority of developers who do not have the experience of using statically compiled languages such as C/c++/java/go.
  • 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.