Please give me some experience using symfony2
大家讲道理
大家讲道理 2017-05-16 16:45:01
0
2
498

Could you please give me some experience of using symfony2 from seniors? I have just learned symfony2 and want to take a shortcut. I have two questions. 1. When learning symfony2, you must learn some things and some are of little use. I hope to hear the experience of seniors in using it. 2. After installing symfony2, which bundles do you usually install and use? Thanks

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
習慣沉默
  1. Symfony 2 components can be disassembled and used (zend2 and so on are like this, benefiting from composer)
  2. Each Bundle is also available through composer

So, I suggest you use whatever you need.

In addition, Symfony 2 is only recommended for individuals or teams that meet the following criteria:

  1. Perform object-oriented design
  2. Multi-person collaboration (more people don’t count)
  3. During the development-testing-deployment process, scripts or continuous integration will be implemented
  4. Seeking a common language and interested in integrating into a big atmosphere
  5. The last one, you don’t have to speak English, but at least you plan to learn English
世界只因有你

1. How can a framework of the magnitude of symfony2 have shortcuts? Its positioning is to be loosely coupled and easy to expand, which is not an easy task. sf2 relies on the configuration system (which can convert various semantic YML configurations into arrays) and the concept of service containers to achieve bundle distribution. Therefore, its flexible and powerful extension architecture is not as simple as it sounds, and there are barriers to use. You have to use compiler passes to implement special injections for various dependencies. And this is the key reason why other PHP frameworks find it difficult to surpass SF2.

For symfony2, theory and practice are equally important. Generally speaking, it is difficult to get started within one year, and it takes two or three years to get started. And English is a must, and climbing out is a must.

The current symfony2 has been forced to repackage and relaunch zend framework3 due to its excellent performance. Therefore, if you want to have a solid grasp of modern PHP development, you should understand how the kernel/httpkernel in the sf2 component works from the bottom layer, that is, from the perspectives of http, request, and response? Then come the other components and features. Among them, the "event" component is extremely important, and event_dispatcher is also the soul of sf2. Download all the official 2.6 version pdfs. Each one is 400 pages and contains about 30 components. According to my understanding, none of them can be bypassed, plus 400 pages of doctrine and 160 pages of twig. It is best to find a 1-page printing shop and print them all out and bind them for reference at any time.

However, there are major changes in version 2.7, because it is a link between the past and the next and is directly connected to 3.0. Still, 2.6 is necessary to fully master. 2.7/2.8 is backward compatible and maintained for a long time, and it will not be compatible with any higher version.

When you can use symfony2 to develop things, your project will naturally be the best. At least you will not and do not need to envy the framework of any other web development language. Symfony2 generates things very quickly, and the page itself can be customized and expanded. Whether it is the form link or the membership link (that is, the security verification/role authorization that cannot be avoided in development), both can be automated. It is really very simple and does not require too much attention (of course the principles of sf2-form and sf2-security must be Yes, there are many concepts in it, such as transform or voter, which must be mastered). If many things using ORM are indeed different from traditional web development, for example, Django's Admin has a more perfect solution in symfony2, which is incredibly powerful.

2. The first 10 items on the first page of knpbundles.com will be used if you want to install them all. There are many others, because in the symfony philosophy you cannot just invent the wheel. For example, third-party packages such as Guzzle, Geshi, Geocoder, etc. do not have to be packaged into bundles by well-intentioned people. You can throw any library (or even your favorite library in Zend2) into Vender intact and use it. Automatic loading provided by symfony2, use it immediately. As for common tools such as google map, fckeditor, markdown, etc., they have already been packaged into bundles and can be downloaded directly from composer.

Speaking of composer, everyone should understand that it was the rigid need of symfony2 that led to the birth of composer. However, the installation of sf2 itself no longer uses composer, only bundles will use it. The core of composer.phar is the console component of symfony2.

A few words to follow up on the point above: According to my understanding, sf2 can be played in two ways, one is for a small number of elites to make big websites; the other is for a large-scale team to make amazing web products. The reason why sf2 is strong is that it can develop "high-end Internet products" other than websites (this is very broad, you can go to sitepoint to search for symfony2 or go to the official website to research successful cases, laravel is just one of them), and Making a website does not require too many people for SF2. The underlying encapsulation and convenience of the framework, as well as the second party with unprecedented expansion capabilities and customization capabilities (many souls of the symfony project have their own bundles) , such as FOS, KNP, stof, JMS, sonata and other experts) and third-party bundles (world-class PHP programmers), can ensure the quality of your project.

The difficulty lies in whether we have the ability to understand and operate the framework. If you know sf2 (mainly DIC, EVENT, FORM, and SECURITY, you must be proficient in these four, you can use annotation during the development process to reduce the total amount of code and reduce the number of switching from php files such as controller to yml files), If you look back at thinkphp3, you will admire the progress of tp3 compared to the previous generation, and if you look at the underlying code of think, you will feel that "it is indeed very simple", really. If you can't get started with sf2, you can still use tp3, because you want to complete the project instead of pursuing something high-end.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!