How the SYMFONY2 framework Works

Source: Internet
Author: User


from the requests (Request) Link start, according to different requests to call the front Controller (Controller), the controller calls the system core function to the requested URI resource routing (routing) resolution, The different action functions are called according to the result of the parsing, generating responses (response data) and returning.

among them, different links are corresponding to different controllers, how the system is judged?

different links must be configured in the App/config/routing.yml file, such as to add/contact links (accessed through index.php/contact), as follows:
Contact :
Path:/contact
Defaults: {_controller:acmedemobundle:Main: Contact}


This configuration means that when the user requests index.php/contact, the routing system executes the contactaction function of the Maincontroller class According to the configuration

The Maincontroller class is deployed as follows:
//src/acme/demobundle/controller/maincontroller.php
Use symfony\component\httpfoundation\response;
Class Maincontroller
{

Public
function contactaction ()

{

//do something implementation function, return here a "contact us!" with H1 label Output

return new Response ('

}

}

Standard Components

The Symfony framework allows us to freely create our own applications and a large number of built-in tools to assist with a wide variety of tasks (such as persisting databases, rendering views, sending messages, processing submission data, validating user input, and handling security)

The Symfony itself contains more than 20 cores of relatively independent components, each of which implements different functions:

Httpfoundation (HTTP Processing): It contains the request class and the response class, mainly handling HTTP requests and responses; session processing; cookie processing; uploading files, etc.

Routing (Routingprocessing): Parses the URI resource and performs the action based on the results of the analysis

Httpfoundation (HTTP Processing):, which contains the request class and the response class, mainly handles HTTP requests and responses; session processing; cookie processing; uploading files, etc.

Form (form Processing): Symfony provides forms components to help us quickly create forms and work with form submission tasks

Validator (HTTP Processing): Define validation rules to validate user-submitted data

ClassLoader (class Loading): auto-load, so that developers can invoke the specified class without the require way to include the file

Templating (Templates): Renders the captured data into an HTML template, separating the logic from the presentation

Security (Handling Security Issues)

Translation (language Translation): Implement multi-lingual capabilities

How the SYMFONY2 framework Works

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.