is PHP's framework typically used for small projects? Segmentfault

Source: Internet
Author: User
Tags redis cluster
What about big projects like that? Without frames. All their own handwritten films?
Or not PHP. Do it in other languages?

Reply content:

What about big projects like that? Without frames. All their own handwritten films?
Or not PHP. Do it in other languages?

Hesitate to answer this question, this is my interview often asked questions, because each framework and each project is not the same, the selection framework is a very look at experience and thinking about the ability to judge.

Project size is only one basis for decision making, or even a less important one. Let's talk about the areas I think you need to be aware of when choosing a frame

Team members & Future team members & local job market situation

First of all, if the team now and the future are only you (such as your own toy project), then choose what you want to use the most good. But as long as it's not the case, you'd better start by understanding the various frameworks that are common on the market and then forget your personal preferences.

Learn about the current situation of your team members, consider the future speed of your team, what team members might be joining in the future, and the job market situation in your location. For example, Laravel may be a good choice, but if you are in a two or three-line city and the team has to develop a large number of people quickly, choosing laravel may soon get you into the dilemma of "composer and modern PHP skills training", Bushi is a great career, but not your career

Project Life cycle & Future Evolution direction

This is one of the factors that I feel is far more important than the size of the project. Some projects, as your company's main business is the need for long-term maintenance, continuous iteration. Other projects may be a marginal, transitional project, and there will be no further requirements to be completed. Finally there are some outsourcing/outsourcing projects, after delivery there will be no demand/follow-up requirements can be when another project.

Larger projects, more demand, if it is a third, regardless of future evolution, then the framework of extensibility can be sacrificed (in exchange for development speed or other benefits), such as the WordPress change and other options can be considered. Again small projects, if your company's main business, continuous iteration, then even if the workload is small, you must carefully consider the extensibility of the framework.

So, what is the extensibility of the framework? Is CI a very extensible framework? Is ZENDFRAMEWORK1/2 a very extensible framework?

The answer is, look at the future evolution direction. Some projects in the future of pressure in the traffic, some pressure in the large number of data retrieval frequently, there are project pressure in demand iteration fast, frequent changes and short cycle. The more common the problems with the project, the more likely the framework of the various solutions will be to reduce the number of repetitive wheels, whereas the more extreme the problem is, the lighter frameworks may be better suited for your team's own research solutions to be grafted into the framework. In addition, the longer the project is maintained, the more difficult the changes are to predict, and the greater the risk of adopting a framework that presets the various solutions (the probability that the preset solution will solve your problem is getting smaller)

Basic qualities of the framework itself

Performance and running points. In addition to the Phalcon and YAF two C implementations of the framework, other frameworks are considered as fast. And unless you're hosting something like Sina Weibo changing the PHP framework, or unless you're managing more than 100 Project Web machines, ignore the PHP framework's performance factors

PSR and composer Affinity. It's a double-edged sword, and we've talked about how to look at this trait before.

Security. Some frameworks even themselves have security flaws that don't say much. In addition, if the framework level provides some security aspects, it is advisable to read the code briefly, sometimes it may not be as good as writing.

Functionality. That is, the number and quality of pre-defined solutions, as mentioned earlier.

Degree of modularity. Whether the various parts within the framework can be customized, and how expensive the customization is.

Business code volume (? It is difficult to find the corresponding word, in short, there is a third feature and the previous two (functional & modular level) together, can not reach the three-and-one. Special features, modularity and high can be arbitrarily customized, replace the framework, often common business code to write a bunch. A sentence can write a lot of functions of the framework, often the degree of modularity is not ideal, not easy to customize. A framework with a high degree of modularity, while the business code is not verbose, is often not rich in preset functions.

The surrounding ecology and activity level as well as compatibility. There is room for growth and improvement in the active framework, but being overly active can sometimes lead to incompatible applications. Another indicator is the surrounding ecology, and there is no other person based on this framework to develop some peripheral modules/plugins and things like that.

Finally, if it is necessary to use the "big" and "small" such rude words to describe the framework and project, my suggestion is that large projects with small framework, small projects with a large framework. If you understand what I said earlier, it should be understandable why I say so.

Small projects with some popular frameworks or something.
Large projects, will write their own framework. What you write will also refer to some mature frameworks, removing some of the unused features or optimizations.
And if you study, it is recommended to look at thinkphp after Laravel finally see Phalcon.

Small forum PUNBB and big Forum discuz! are not the framework of the PHP program, it can be seen that the framework is not a project necessary things.
PHP itself is a web framework, separate the interface and logic, to implement MVC, such as:
Front desk:

/post.php?id=1024                        //页面控制器(处理输入,调用模型,整合数据,输出视图)    /include/common.php                  //执行一些公共操作,加载公共库(承上启下).        /config.php                      //全局配置        /include/functions.php           //系统函数(模型,SQL增删改查,预处理参数化查询防止SQL注入)        /themes/default/functions.php    //主题自定义函数    /include/database.php                //按需连接数据库    /themes/default/post.php             //视图(htmlspecialchars/HTMLPurifier防止XSS)        /themes/default/header.php       //公共头部(common.js)        /themes/default/footer.php       //公共尾部

Background:

/admin/post.php                                //页面控制器(处理输入,调用模型,整合数据,输出视图)    /include/common_admin.php                  //执行一些公共操作,加载公共库(承上启下).        /config.php                            //全局配置        /include/functions.php                 //系统函数(模型,SQL增删改查,预处理参数化查询防止SQL注入)        /admin/themes/default/functions.php    //后台主题自定义函数    /include/database.php                      //按需连接数据库    /admin/themes/default/post.php             //视图(htmlspecialchars/HTMLPurifier防止XSS)        /admin/themes/default/header.php       //公共头部(common.js)        /admin/themes/default/footer.php       //公共尾部

The bigger the project, the more need frame to unity and specification, otherwise the developer a lot, each engage each, also how to play? It is only the framework itself that chooses to develop itself, or chooses the problem with the existing source framework.

The medium size is completely free of pressure and can be too large to fit. should be suitable for medium and large scale application development

Do not know in your eyes Baidu bar is not a big project, in not moved to HHVM has been the use of PHP,

Not to use, it is necessary to use. But the framework of big companies is not necessarily the ones that are well known outside. such as Baidu, is based on the expansion of YAF,

This depends on the situation, PHP is indeed more suitable for small and medium-sized projects, because the PHP development cycle is short, high efficiency. But big companies are also going to pick up

With PHP, such as Sina Weibo, he has the ability to improve PHP, some people have the strength to write PHP high-availability extension, to the performance of PHP to play a very

And then, with the help of NoSQL, high concurrency can be completely above MySQL. The Redis cluster of Weibo is very big now, there are a lot of

Operation does not go into the database operation that layer, in the RE/MC to solve, so PHP for what kind of project or to see the team, see driving

Ability to harness PHP.

Large projects as useful PHP ah, you see a framework called enterprise-level development framework, it is generally possible to develop large-scale projects, of course, this large depends on your project how much

Small, medium and large projects can adopt the framework! If you have the conditions, we recommend using the frame as much as possible.

Since others have already written so many frames, then don't reinvent the wheel, but learn how to use it.

To learn some of the heavyweight frameworks, like Symfony, Yii, Phalcon, Laravel and so on,
These frameworks are used in many large projects. Of course, if you are involved in a major project later on, you are likely to be exposed to them,
You now learn and use them, is to lay the groundwork for you later!

A heavyweight framework, involving a lot of things, also helps in-depth learning of PHP.

Https://github.com/lloydzhou/router

What is the size of the project is small, generally so-called large projects are broken down into a number of small projects, these "small projects" will have their own language and framework of implementation,

No matter the size of the project, basic performance bottlenecks are not in PHP, unless you deliberately write bad, even so PHP is extremely fast.
Bottlenecks are more in the database.

  • 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.