Last active
June 26, 2020 05:59
-
-
Save samirreza/b3b96ca3c8adcfebe1d7961fb9731170 to your computer and use it in GitHub Desktop.
Explain Symfony Bootstratpping Process (to be continued !!!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. load environment variables from .env files in _ENV and _SERVER super global among APP_ENV and APP_DEBUG | |
2. enable debug component if APP_DEBUG is true | |
3. instantiate kernel with APP_ENV and APP_DEBUG | |
4. create Request object from super globals | |
5. call handle method on kernel with Request object | |
1. prepare registered bundles array | |
2. initialize service container | |
1. initiate ContainerBuilder object and add its definition with service_container id | |
2. add some kernel parameters | |
3. if kernel implement CompilerPassInterface, add it as compiler pass | |
4. register bundle’s extensions (Extension’s load method called by MergeExtensionConfigurationPass and bundle’s configurations and temporary container injected in it and then merged with others, this compiler pass is always the first compiler pass). in this step we just add extension to an array | |
5. build method on each bundle and kernel called. its a good place for adding compiler pass | |
6. implicitly set compiler merge pass with extensions’s alias | |
7. initiate config loader resolver | |
8. set router with kernel::loadRoutes | |
9. register kernel as synthetic and public service and add routing.route_loader tag (loadRoutes will call) | |
10. if kernel implements EventSubscriberInterface add kernel.event_subscriber tag to it | |
11. service definitions and configurations load in service container by convention with help of config loader resolver. service definitions are loaded in definitions parameter and configurations are loaded in extensionConfigs parameter | |
12. service container compiled and pass throw the chain of compiler passes (all service container features implemented by one compiler pass) | |
13. all configurations become parameter in service container with . notation prefix for bundle alias. this done by MergeExtensionConfigurationPass. SO THIS COMPILER PASS CALL EXTENSION’S LOAD METHOD WITH ARRAY OF CONFIGURATIONS AND FRESH INSTANCE OF SERVICE CONTAINER AND THEN MERGE IT WITH MAIN SERVICE CONTAINER | |
14. in extension’s load method, extension can load and validate configurations and service definitions and then set definitions for services and set parameters in injected service container | |
15. service container cached | |
3. inject service container to each bundle via setContainer method and call its boot method | |
4. call handle on HttpKernel | |
1. push Request to stack | |
2. ... | |
1. create Response object | |
6. send Response to client | |
1. send headers | |
2. send content | |
7. terminate kernel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment