This article mainly introduces the core classes of Symfony, and briefly analyzes the core classes, organizational structure and corresponding functions of Symfony. Friends in need can refer to it. I hope it will be helpful to everyone.
The details are as follows:
Symfony’s core classes
Symfony’s MVC method uses some classes that you will often encounter in the future
1. sfController is the controller, it decodes the request and delivers it to the action
2. sfRequest stores all request elements (parameters, cookies, header information, etc.)
3. sfResponse contains response header information and content, which are ultimately converted to HTML and sent to the user
4. A context (obtained through sfContext::getInstance()) saves all core objects Reference and existing configuration information can be accessed from any location.
As you can see, all symfony classes use the sf prefix. This avoids conflicts with your own classes or variables and makes core framework classes easier to identify.
Organization of code
You already know the different components of a symfony application, but you may not know how it is organized.
Project structure: applications, modules and actions
In symfony, a project is a set of services and operations under a specified domain name, and they share an object model.
A project is composed of multiple applications. An application is composed of multiple modules. A module can contain multiple actions.
Project structure diagram:
#Symfony’s root tree structure and description
apps/ |
Contains items Application, one application corresponds to a folder |
Batch/ |
containsPHPcode executed or scheduled from the command line |
##Cache/ | Cache folder, requires777permission |
Save the basic configuration of the project |
|
Save the project Data files, such as database structures, SQLfiles that create data tables, orSQLitedatabase files, etc. |
|
Store project documents, including your own documents and documents generated by PHPDoc |
|
Lib/ |
Data Model |
Log/ |
Log folder, requires777permission |
Plugins/ |
Stores the plug-ins installed in the application |
Test/ |
half-heated unit and common testing |
##Web/ | WEB Root of service |
Solution to the problem when installing under symfony window
php symfony/var-dumper method to install the printing plug-in
Summary introduction to query methods in Symfony
The above is the detailed content of A brief introduction to Symfony core classes. For more information, please follow other related articles on the PHP Chinese website!