Brief introduction of Symfony core class

Source: Internet
Author: User
This paper mainly introduces the core class of Symfony, analyzes the core class, organization structure and corresponding function of symfony simply. Need friends can refer to, hope to help you.

Specific 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 folder, requires 777 permissions

config/

Save the basic configuration of the project

data/

A data file that holds the project, such as the database structure, creating a data table SQL files, or SQLite database files, etc.

doc/

Store project documents, including your own documents and PHPDOC the resulting document

lib/

Data model

log/

log folder, requires 777 permissions

plugins/

Plugins installed in the app

test/

involves unit and commonality test

web/

the root of the WEB service

Related recommendations:

Workaround for problems when installing Symfony window

PHP symfony/var-dumper How to install the print plugin

Summarize the method of query in Symfony

Related Article

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: info-contact@alibabacloud.com 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.