This paper describes the core class of Symfony. Share to everyone for your reference, specific as follows:
The core class of Symfony
Symfony's MVC approach uses some of the classes you'll often encounter
1. Sfcontroller is the controller, he decodes the request and passes it to the action (action)
2. Sfrequest stores all request elements (parameters, Cookies, header information, etc.)
3. Sfresponse contains the response header information and content, which is the final thing to convert to HTML and send to the user
4. A context (obtained by sfcontext::getinstance ()) holds the reference and existing configuration information for all the core objects, and he can be accessed at any location.
As you can see, all symfony classes use the SF prefix, which avoids conflicts with your own classes or variables, and makes it easy to identify the core framework's classes.
Organization of the Code
You already know the different composition of the Symfony application, but you may not know how he is organized.
Project structure: Applications, modules, and actions
In Symfony, a project is a set of services and operations under the domain name, and they share the object model.
A project is composed of multiple applications, one application has multiple modules, and a module can contain multiple actions.
Project Structure Chart:
The root tree structure and description of Symfony
apps/ |
Contains the application of the project, one application corresponds to a folder |
batch/ |
that contains the command line execution or dispatch. PHP Code |
cache/ |
cache folder, requires 777 the Permissions |
config/ |
Save the basic configuration of a project |
data/ |
A data file that holds a project, such as a database structure, creating a data table SQL file, or SQLite database files, and so on. |
doc/ |
store project documentation, including your own documents and PHPDoc the resulting document |
lib/ |
Data model |
log/ |
log folder, which requires 777 Permissions |
plugins/ |
Stored plugins installed in the application |
test/ |
Han Unit and Generic test |
web/ |
WEB root of the service |
I hope this article will help you with the PHP program design based on Symfony framework.