This article describes the Symfony core class. Share to everyone for your reference, as follows:
The core class of Symfony
Symfony's MVC approach uses some of the classes you'll often encounter later.
1. Sfcontroller is the controller, he decodes the request and is specifically handed to the action (action)
2. Sfrequest stores all the request elements (parameters, Cookies, header information, etc.)
3. Sfresponse contains the response header information and content, these are the things that will eventually be converted to HTML and sent to the user
4. A context (obtained through sfcontext::getinstance ()) holds references and existing configuration information for all core objects, which can be accessed from anywhere.
As you can see, all symfony classes use the SF prefix, which avoids conflicts with your own classes or variables, and makes the class of the core framework easy to identify.
Organization of the Code
You already know the different compositions of the Symfony application, but may not yet know how he is organized.
Project structure: Applications, modules and actions
In Symfony, a project is a set of services and operations under a domain name, and they share the object model.
A project is made up of multiple applications, one with multiple modules, and one module that can contain multiple actions.
Project Structure diagram:
The structure and description of root tree of Symfony
apps/ |
Contains the application of the project, one application corresponding to a folder |
batch/ |
that contains the command line execution or dispatch. PHP Code |
cache/ |
cache folders, you need to 777 the Permissions |
config/ |
Save the basic configuration of the project |
data/ |
data files for the project, such as database structure, creating a data table sql file, or sqlite |
doc/ |
Store project documents, including your own documents and PHPDoc the resulting document |
lib/ |
Data model |
log/ |
log folder, you need to 777 Permissions |
plugins/ |
Plugins installed in the app |
test/ |
involves unit and commonality test |
web/ |
WEB root of the service |
It is hoped that this article is helpful to the PHP program design based on Symfony framework.