How can a beginner in PHP learn how to use the development framework? is there any case?

Source: Internet
Author: User
Tags mysql manual
As a beginner in php, how should I learn a development framework? where should I start? how can I learn faster and more systematically? As a beginner in php, how should I learn a development framework? where should I start? how can I learn faster and more systematically? Reply: thinkphp is quick to get started and has relatively complete functions! Extensive online tutorials... after reading this article, I will learn CodeIgniter, zend Framework, and yii will benefit a lot. the main reference PHP frameworks include: CodeIgniter, CakePHP, ZendFramework, Symfony. I have not used many frameworks seriously, but I just tried it for a while. many ideas may be immature or incorrect. please correct me and grow together.
1. the configuration is simple. all configurations are configured using PHP scripts with high execution efficiency. it has the basic routing function and can perform a certain degree of routing. it has the preliminary Layout function, ability to make a certain degree of interface appearance; database layer encapsulation is good, with basic MVC functions
2. quick and concise, with few codes, high execution performance, simple PHP framework, easy to use, low learning costs, and detailed documentation. it comes with many simple and easy-to-use libraries and is suitable for small applications.
1. a simple understanding of the Model layer as a database operation
2. the PHP framework is slightly simpler. it can only meet the needs of small applications and slightly less meet the needs of medium-sized applications.
In general, it is worthwhile to use CodeIgniter to complete simple and fast applications. at the same time, it can construct a certain degree of layout to facilitate template reuse. in the data operation layer, encapsulation is not wrong, in addition, CodeIgniter does not use many complicated design modes, and the execution performance and code readability are both good. The additional library is also good, concise and efficient.
1. cakePHP is the PHP framework most similar to RoR, including the design method and the Active Record mode for database operations. the design level is very elegant and there is no redundant library. all functions are pure frameworks, execution efficiency is good; hasOne and hasOne at the database layer have powerful functions and are suitable for complex business processing; routing and configuration functions are good; scaffold is powerful; suitable for medium-sized applications. it has basically implemented every layer of MVC and has the ability to automatically operate command line scripts;
2. the document is comprehensive and has been successfully promoted in China. most of them know CakePHP, and the learning cost is moderate.
1. a very serious problem with CakePHP is to regard the Model as a database-layer operation, which seriously affects the operation capability other than the database.
2. the cache function of CakePHP is slightly weak, and the configuration function is slightly weak. CakePHP is not suitable for large applications and is only suitable for medium-sized applications. for small applications, the learning cost is slightly higher.
In general, the CakePHP framework represents a very important era and representative of the PHP framework, and currently plays a very important role. many self-written frameworks mimic the CakePHP method, cakePHP is a milestone product. CakePHP discloses RoR's agile development method and database operations as the only Model design concept. it is an excellent tool for developing fast applications and prototypes. Similarly, it is also worth choosing.
Zend Framework
1. the official product comes with a lot of libraries. the framework itself uses a lot of design patterns to write, the architecture is very elegant, and the execution efficiency is moderate. in MVC design, it is concise and has routing functions, the configuration file is powerful (it can process XML and php INI), and various libraries are powerful. it is the most comprehensive function in all PHP frameworks, including not only a PHP framework, it is also a big-Class Library (replacing PEAR), which is its main characteristic. it can intuitively support Model layers other than database operations (better than CodeIgniter and CakePHP ), in addition, it is easy to use the Loader function to load other new classes. the Cache function is very powerful and supports both the front-end Cache and the back-end Cache, the backend Cache supports Memcache, APC, SQLite, and files. the database has powerful operations and supports various drivers (adapters)
2. the documentation is comprehensive and mature in domestic communities. Currently, many 2.0 Web websites are in use, and the learning cost is moderate.
1. the MVC function is relatively weak, and the View layer is simple to implement (the same as not implemented), so it cannot control the front-end page very effectively.
2. there is no automated script. to create an application, including the entry file, all the files must be built manually. the entry cost is high.
3. Zend Framework, as a medium-sized application Framework, has little problem and can barely serve as a PHP Framework for large applications. However, as a very mature large PHP Framework, some efforts are required.
As an official Framework, Zend Framework's ambition is foreseeable. it also encapsulates many powerful class libraries to provide one-stop Framework services, in addition, their development team is strong enough to develop very powerful products. Therefore, we can basically determine that Zend Framework has a promising future. if they spend more time improving the Framework. Similarly, the Zend Framework Architecture itself is relatively elegant. it indicates that Zend has many experts and its design concepts are advanced. although some functions are not complete enough, such as The View layer, automatic scripts and so on, all of which depend on future upgrades. In general, Zend Framework is the most promising PHP Framework. of course, it is no problem to invest in your project.
1. symfony is the most powerful PHP framework I know, and I have been using it for a long time, but many functions have not been mined. it fully implements the MVC layer 3 and encapsulates everything, including $ _ POST, $ _ GET data, exception handling, debugging, and data Detection. It includes powerful cache functions and automatically loads Class (this function is great ), powerful i18n state-based support; powerful view layer operations that can contain a single file in a fraction; very powerful configuration functions, yml configuration can be used to control all framework and program running behaviors, which is powerful enough to make people speechless. it can define various classes at will, and symfony can automatically load these classes (auto load, can be called at will in the program; contains powerful multi-level Project and Application management: Project --> Application --> Module --> Action, can meet the needs of multiple applications under a Project, in addition, each layer can define its own class library, configuration file, and layout; very powerful command line operation functions, including creating projects, applications, modules, and cache refreshing;
2. symfony is definitely the first choice for developing large and complex projects, because the use of Symfony will greatly save development costs, and there will be no problems when many people collaborate, after defining the basic Class at the Project level, any module can be reused, greatly reusing code
1. the database operation model adopts the heavyweight propel and creole, but they have been moved to addon in the version I tested. they are available but not needed.
2. the cache function cannot be controlled. every development and debugging is always cached. you need to execute symfony cc and symfony rc to clear and recreate the cache;
3. the efficiency is not very high. it takes a lot of time to parse the template and read the configuration file;
4. the learning cost is very high, and there are no mature communities and documents in China, even Chinese manuals. it takes a lot of time to master all functions.
Symfony is definitely an enterprise-level PHP Framework. it is the only thing that seems to be able to compete with powerful frameworks in the Java field. powerful things are naturally complicated to learn, however, it is also helpful for project development and development. Naturally, it is recommended to use Symfony for complex projects. it is worthwhile. later maintenance costs are relatively low and the reusability is very strong. If Symfony is used as a complex Internet project, you need to consider the database distribution issue. Therefore, you need to discard the database operation layer that comes with Symfony and define it by yourself, of course, Symfony supports constructing the model layer at will.
The above PHP frameworks have their own characteristics and are all open-source projects. However, the frameworks are different for different projects. CodeIngiter is generally more suitable for small projects, and CakePHP and Zend Framework are more suitable for medium-sized projects, symfony is suitable for large heavyweight projects. when selecting a project, you must fully consider the customization and scalability of the framework, because each project cannot determine whether you will change as the demand changes.
Relatively speaking, Zend Framework and Symfony have strong ability to cope with changes, especially the ability to customize model-layer classes at will, which makes it very convenient to add their own business or data processing classes, I personally recommend using the PHP framework in large and medium-sized projects.
CodeIngiter and CakePHP can also play a major role in small and medium-sized projects, rapid development and prototyping, and are very suitable for the development of target and unclear prototype projects.

Do not get started with the framework at the beginning, otherwise it will be easily circled by the framework. First write from the most basic PHP, and then slowly encapsulate some of your own classes. In this process, you can sort out a set of your own development classes. these classes can be said to be a framework, a framework dedicated to you.
Now let's look at some popular frameworks, such as Yii and CakePHP. Understand the idea of the framework and learn how to use the framework flexibly, instead of limiting the APIs provided by the framework.
I remember that when ThinkPHP was used, too many people did not learn PHP well or even did not know what PEAR was. Although many things can be made by using the features provided by TP, it does not happen when some documents are not mentioned or need to be used flexibly. This can be said to be the sorrow of using the framework.
Write PHP naked --> use classes --> understand MVC (or design patterns) --> framework --> flexible use --> You can use settings to modify the framework as you like.
This is an order that I think is for reference only. CodeIgniter recommended

1. the example is detailed and can be used directly.
2. complete Chinese documents
3. the framework design is concise and clear, and the function is powerful. thanks @ justjavac for your invitation.

Prerequisites: Newbie, framework

Therefore, we should first exclude medium (CakePHP, Yii), large frameworks (ZF, Symfony), and answers that are written directly using native code, the rest is to make a choice from the small PHP framework. From the perspective of beginners, it is most important to be easy to use and understand. a framework suitable for beginners should meet the following conditions:

-Excellent and easy-to-understand documents
-Gentle learning curve
-Low learning costs
-Relatively standard framework, not unpopular
-A wide range of reference resources and tutorials such as answers and communities are available even if there are many users and problems.
-Do not add complex design patterns
-Simple framework elements, such as MVC, templates, models, class libraries, and helper

To sum up, we recommend: CodeIgniter
I have written a small framework for Beginners: phoenixg/phx GitHub. If you are a newbie, you should first read the PHP manual and MYSQL manual, and master the basic knowledge securely. This is the most important thing. If you want to learn the PHP framework, I strongly recommend doitphp. it's easy to get started. I started with fleaphp. I personally think this framework is very clear.
The example is also good ..

Later I had access to qeephp. the method of object chained query is very simple, but it is indeed very performance-consuming. now I am using the framework written by my team. I have been using Drupal for some time. it is recommended that you do not use it for new users. it is difficult for new users. Wordpress, zendphp, and thinkphp were gradually used for projects that were successively claimed, and they were too complicated and the information was not comprehensive. Recently, I used CI to build a large project. In general, CI Chinese documents are detailed and lightweight, so I have to write many things on my own. If you want to learn CI, you can not only gain a deep understanding of the essence of MVC, but also improve your language development level. The learning method is to follow the . Start with Zend Framework and master the running mechanism. Do not be afraid of complexity, so that you can simplify things as you like.

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