CodeIgniter 4.5の処理の流れ

CodeIgniter 4.5の処理の流れをまとめました。

CodeIgniter 4.5 Process Flow

CodeIgniter 4.5 Process Flow

public/index.php

check PHP version
define constant FCPATH
set current directory
instantiate Config\Paths
  • Config\Paths
    • $systemDirectory
    • $appDirectory
    • $writableDirectory
    • $testsDirectory
    • $viewDirectory
load system/Boot.php
  • Boot
    • define path constants
      • APPPATH
      • ROOTPATH
      • SYSTEMPATH
      • WRITEPATH
      • TESTPATH
    • load constants
      • load Config/Constants.php
    • check missing required PHP extensions
    • load dot env
      • instantiate DotEnv
        • load .env file
    • define Environment
    • load Environment bootstrap
    • load common functions
      • load Common.php
    • load Autoloader
      • Services::autoloader()
        • instantiate Autoloader
        • initialize()
          • load Composer autoloader
        • register()
      • load Services
    • set Exception handler
      • Services::exceptions()
        • instantiate FileLocator
        • initialize()
          • set Exception/Error handler
    • initialize Kint
    • autoload helpers
      • load URL helper
    • initialize CodeIgniter
      • Services::codeigniter()
        • instantiate Config\App
        • instantiate CodeIgniter
      • initialize()
        • set default locale (Locale::setDefault())
        • set default timezone
      • setContext()
    • run CodeIgniter
      • run()
        • getRequestObject()
          • Services::createRequest()
            • Services::incomingrequest()
              • Services::uri()
                • Services::siteurifactory()
                  • instantiate SiteURIFactory
                • SiteURIFactory::createFromGlobals()
                  • detectRoutePath()
                    • update superglobals
                      • update $_SERVER
                      • update $_GET
                  • instantiate SiteURI
              • instantiate UserAgent
              • instantiate Request
                • IncomingRequest::__construct()
                  • detectLocale()
                    • if $negotiateLocale is true
                      • get lang from content negotiation
                      • setLocale()
                        • set locale in Request
                        • set default locale (Locale::setDefault())
          • spoof request method
        • getResponseObject()
          • instantiate Response
        • Event pre_system
        • instantiate Filters
        • run Required before Filters
          • force secure access
          • check Page Cache
        • handleRequest()
          • tryToRouteIt()
            • instantiate Routes
            • instantiate Router
            • get Controller and method name
            • get locale from route
              • if route contains locale
                • Request::setLocale()
                  • set locale in Request
                  • set default locale (Locale::setDefault())
            • get Route Filters Info
          • enable Controller Filters
          • run before Filters
          • run Controller
            • run Closure controller
            • or
              • instantiate Controller
              • Event post_controller_constructor
              • run Controller method
          • gather output
          • run after Filters
          • return Response object
        • run Required after Filters
        • Event post_system
        • sendResponse()

関連

Date: 2024/04/16

Tags: codeigniter, codeigniter4