Home >Backend Development >PHP Tutorial >Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial

Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:37:541043browse

demon believes that an excellent framework is not just a few business flows, it should be extensible,
be rich, a collection, and discrete. Simply put, it is the contradiction of all things, both dissociated and aggregated.

Volume cut-in:

                                                                                                                                                 1.2116993KBThinkPHP 1.5947KBZendFramework-1.7.8-minimal16.1MBsymfony 1.2 .511.1MB Note: The above are the minimum sizes after deleting unnecessary files such as doc, test and other files Roughly think:

Domestic frameworks are generally smaller, while foreign frameworks are generally larger. . -You cannot simply think that small size is good here.

Directory structure:

thinkphp

                                                                                      The runtime,
function library, the universal file lang is probably the core internal language

lib/org is some common tools: date, io, net, rbac, text, etc. lib/think is the core,

Mainly focuses on the mvc process plugin, which is an adaptation plug-in.

Summary: It is really too small.

You can see everything at a glance. Demon analyzes the thinkphp process from a beginner’s perspective: Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial Initialization Load the necessary files, common, and several classes under core.
You can call new app(),
and then run it with init.
Guess the app instantiates the diapatcher and then calls a method similar to run.
Start action routing.

qeephp
Look at the directory structure of QEEPHP thickly, Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial is very comfortable,
The level is clear,
Each folder corresponds to a functional domain.
And each file has a corresponding exception.
command command line shortcut. It should be noted that the behavior under
extend is bound to the model.
It can be said to be decorate mode.
It can be seen in qeephp that some design patterns are used to meet scalability,
Single responsibility.
How to start qeephp. .
Can’t find it yet.
This is due to the benefits of single responsibility.
Refer to the official documentation:
See:
// Get application startup information
$app_config = require(dirname(__FILE__) . '/../config/boot.php');
// Load the QeePHP framework and application objects according to the settings in the startup information
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR' ] . '/myapp.php';
//Construct the application object and start the MVC mode
echo MyApp::instance($app_config)->dispatching();
Very comfortable. . .
But the streamlining is not enough,
especially the relationship between myapp.php and the following MyApp::instance($app_config)->dispatching();
is very uncoordinated. (I think the author’s intention is to think of multi-entry multi-application and deployment modes,
but the entry should not be aware of the file name, but the index)
For example:
// According to the startup information Set up the QeePHP framework and application object
require $app_config['QEEPHP_DIR'] . '/library/q.php';
// Get application startup information
$app_config = qee_App::getConfiguration ("myapp");
//Construct the application object,
and start the MVC mode
qee_App::createInstance($app_config)->dispatching();
Isn’t this better.
There is no cumbersome manual loading.
You only need to know the name of which app you want to run.
Summary:
It can be said that qeephp can be studied from the current directory structure.

Of course there are still some problems.
In summary, qeephp is better than thinkphp in terms of directory structure
cakephp

                                                                                .

Then the core is 4 cache, controller, model, view. It’s really MVC. . . It’s very simple, too simple, Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorialcakephp provides cli to initialize a basic mvc application.
So the startup method is similar to qeephp.

zend
                                                                  ​ 
zend is obviously very clear, clearer than qeephp, symfony,

and very complete.

The characteristic is that the folder can complete certain tasks alone. This allows all classes to be separated separately. Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorialThe external php file is encapsulated.
The corresponding directory is included in the class. Classes,
are combined using the combination mode.
The startup method of zend is not familiar.
But it shouldn’t be bad.

symfony
                                                                                                                                                                                        

The structure of symfony is also relatively clear,
but its granularity is more delicate than zend.
It separates controller, response, and request. But overall, it is inferior to zend,

is not comprehensive enough, and

is not discrete enough. Some components of symfony Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial have certain dependencies.

Summary:

Judgment criteria:

1. Is the directory hierarchy clear?
2. Whether the meaning conveyed by the directory is consistent with its internal class'

3. Directory structure consistency

From a directory perspective zend>symfony>qeephp>cakephp>thinkphp

Class diagram

thinkphp

Core class diagram, we can see single root inheritance, derived from base. Almost all classes in think inherit from base

The class diagrams of util are all derived from base. I use a simple hierarchical relationship to describe the structure of thinkphp

with base as the center and radiating outward.

qeephp

Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial

Look at the root class diagram in ea, which is just a q, how comfortable it is, and in other classes, he does not use patterns for the sake of patterns.

Look at the picture:

Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial

See, there is a single class without any relationship, and a class such as context is used to manage the application context. This is a very Good design ideas. It should be based on symfony. It will be analyzed later.

The class hierarchy of qeephp can be said to be free and scattered.

symfony

It took 8 minutes to generate the class diagram, which shows how huge it is

Remove the orm layer plug-in (symfony's mvc, m is supported by plug-in plug-in, prop or doctrine)

The mechanism of applying plug-ins symfony can flexibly change m.

Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial

is also an unrelated single class, and reads different configuration files through derivation.

Symfony uses derivation in many cases. Its configured drivers are uniformly driven by sfcontext and managed uniformly by sfconfig. A good architecture and a single responsibility allow multiple classes to complete the MVC business flow driven by sfcontext.

The location of sfcontext is util, the basic suite. That is to say, if you do not need to run mvc mode, you only need to create a running context without calling the dispatcher of sfcontext. MVC is still in command line mode. Depends on the method you call.

Elegant and simple, not messy.

A context class manages all components needed under mvc.

Thinkphp, qeephp, cakephp, zendframework, symfony comparison_PHP tutorial

zend

Similarly elegant and simple, it also uses a context to manage everything.

The zend is too big, so I won’t post the picture.

cakephp

cakephp has nothing to say. It's really too weak. Demon classifies it into thinkphp, qeephp, and cakephp.

Time was tight and it took 3 hours to complete the preliminary comparison. Of course, the one that suits you best is the best.

Symfony and zend are suitable for demon, so viewers can make up their own minds.

Summary:

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/735141.htmlTechArticledemon believes that an excellent framework is not just about completing a few business flows, it should be extensible. It is rich, it is a collection, it is discrete. Simply put, it is the contradiction of all things, both...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn