# vanhaex/eslf architecture

> Architecture diagram of the GitHub repository vanhaex/eslf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vanhaex/eslf
- Repository: https://github.com/vanhaex/eslf

## Overview

ESLF is a lightweight PHP MVC web framework. Its main request workflow starts at the public entry point, applies middleware, selects configured routes, invokes a controller or API handler, and returns rendered or JSON output. Supporting capabilities include input/session utilities, database-backed models, alerts, logging, and ESbuilder commands. The graph preserves README-documented capabilities, but several command and middleware implementations were not excerpted; links to those are limited to documented or entry-point relationships.

Main entry points: [`public/index.php`](https://github.com/vanhaex/eslf/blob/master/public/index.php) (HTTP entry point), [`framework/Router.php`](https://github.com/vanhaex/eslf/blob/master/framework/Router.php) (Router), [`framework/InputUtility.php`](https://github.com/vanhaex/eslf/blob/master/framework/InputUtility.php) (Input handling), [`framework/Middlewares/Middleware.php`](https://github.com/vanhaex/eslf/blob/master/framework/Middlewares/Middleware.php) (Middleware base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Request Runtime"]
  node_entry["HTTP entry point<br/>[index.php]"]
  node_routes_config["Route configuration<br/>[RoutesConfig.php]"]
  node_router["Router<br/>[Router.php]"]
  node_route["Route matching<br/>[Route.php]"]
  node_api_dispatch["API dispatch<br/>[ApiController.php]"]
  node_api_example["API endpoint<br/>[HelloApi.php]"]
  node_middleware["Middleware base<br/>[Middleware.php]"]
  node_headers["Header middleware"]
  node_csrf["CSRF middleware"]
end

subgraph group_mvc["MVC and Data"]
  node_home_controller["Home controller<br/>[HomeController.php]"]
  node_controller_base["Controller base<br/>[Controller.php]"]
  node_view["Smarty rendering<br/>[View.php]"]
  node_templates["Page templates<br/>[home.tpl]"]
  node_model_base["Database model<br/>[Model.php]"]
  node_home_model["Home model<br/>[Home.php]"]
  node_db_config["Database settings<br/>[DatabaseConfig.php]"]
end

subgraph group_utilities["Request Utilities"]
  node_app_config["Application settings<br/>[AppConfig.php]"]
  node_input["Input handling<br/>[InputUtility.php]"]
  node_session["Session handling<br/>[SessionUtility.php]"]
  node_logging["Logging<br/>[LogWriting.php]"]
  node_alerts["Alert messages<br/>[AlertMessage.php]"]
  node_alert_plugin["Smarty alert plugin"]
end

subgraph group_tooling["Framework Features"]
  node_commands["ESbuilder commands"]
end

node_user(("Web client"))
node_database[("SQL database")]
node_cli_user(("Developer"))

node_user -->|"sends request"| node_entry
node_entry -->|"runs middleware"| node_middleware
node_entry -->|"loads routes"| node_routes_config
node_routes_config -->|"registers routes"| node_router
node_entry -->|"dispatches request"| node_router
node_router -->|"matches route"| node_route
node_router -->|"dispatches API"| node_api_dispatch
node_middleware -->|"runs headers"| node_headers
node_middleware -->|"runs CSRF check"| node_csrf
node_route -.->|"invokes controller"| node_home_controller
node_api_dispatch -->|"resolves endpoint"| node_api_example
node_home_controller -->|"extends"| node_controller_base
node_home_controller -->|"renders through"| node_view
node_view -->|"renders template"| node_templates
node_home_model -->|"extends"| node_model_base
node_model_base -->|"reads settings"| node_db_config
node_model_base -->|"queries"| node_database
node_entry -->|"reads request"| node_input
node_router -->|"cleans request"| node_input
node_session -->|"sanitizes session access"| node_input
node_csrf -->|"checks submitted input"| node_input
node_controller_base -->|"checks settings"| node_app_config
node_controller_base -->|"initializes logging"| node_logging
node_alerts -->|"stores alerts"| node_session
node_alert_plugin -->|"uses alerts"| node_alerts
node_cli_user -->|"runs commands"| node_commands

click node_entry "https://github.com/vanhaex/eslf/blob/master/public/index.php"
click node_routes_config "https://github.com/vanhaex/eslf/blob/master/config/RoutesConfig.php"
click node_router "https://github.com/vanhaex/eslf/blob/master/framework/Router.php"
click node_route "https://github.com/vanhaex/eslf/blob/master/framework/Route.php"
click node_api_dispatch "https://github.com/vanhaex/eslf/blob/master/framework/ApiController.php"
click node_api_example "https://github.com/vanhaex/eslf/blob/master/app/api/HelloApi.php"
click node_middleware "https://github.com/vanhaex/eslf/blob/master/framework/Middlewares/Middleware.php"
click node_headers "https://github.com/vanhaex/eslf/blob/master/framework/Middlewares/SetHeadersMiddleware.php"
click node_csrf "https://github.com/vanhaex/eslf/blob/master/framework/Middlewares/VerifyCSRFMiddleware.php"
click node_home_controller "https://github.com/vanhaex/eslf/blob/master/app/controller/HomeController.php"
click node_controller_base "https://github.com/vanhaex/eslf/blob/master/framework/Controller.php"
click node_view "https://github.com/vanhaex/eslf/blob/master/framework/View.php"
click node_templates "https://github.com/vanhaex/eslf/blob/master/views/home.tpl"
click node_model_base "https://github.com/vanhaex/eslf/blob/master/framework/Model/Model.php"
click node_home_model "https://github.com/vanhaex/eslf/blob/master/app/model/Home.php"
click node_db_config "https://github.com/vanhaex/eslf/blob/master/config/DatabaseConfig.php"
click node_app_config "https://github.com/vanhaex/eslf/blob/master/config/AppConfig.php"
click node_input "https://github.com/vanhaex/eslf/blob/master/framework/InputUtility.php"
click node_session "https://github.com/vanhaex/eslf/blob/master/framework/SessionUtility.php"
click node_logging "https://github.com/vanhaex/eslf/blob/master/framework/LogWriting.php"
click node_alerts "https://github.com/vanhaex/eslf/blob/master/framework/AlertMessage/AlertMessage.php"
click node_alert_plugin "https://github.com/vanhaex/eslf/blob/master/smarty_plugins/function.add_alert_message.php"
click node_commands "https://github.com/vanhaex/eslf/tree/master/framework/Command"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_routes_config,node_router,node_route,node_api_dispatch,node_api_example,node_middleware,node_headers,node_csrf,node_user toneBlue
class node_home_controller,node_controller_base,node_view,node_templates,node_model_base,node_home_model,node_db_config,node_database toneAmber
class node_app_config,node_input,node_session,node_logging,node_alerts,node_alert_plugin toneMint
class node_commands toneRose
class node_cli_user toneIndigo
```

## Components

### Request Runtime

- [HTTP entry point](https://github.com/vanhaex/eslf/blob/master/public/index.php): `public/index.php`
- [Route configuration](https://github.com/vanhaex/eslf/blob/master/config/RoutesConfig.php): `config/RoutesConfig.php`
- [Router](https://github.com/vanhaex/eslf/blob/master/framework/Router.php): `framework/Router.php`
- [Route matching](https://github.com/vanhaex/eslf/blob/master/framework/Route.php): `framework/Route.php`
- [API dispatch](https://github.com/vanhaex/eslf/blob/master/framework/ApiController.php): `framework/ApiController.php`
- [API endpoint](https://github.com/vanhaex/eslf/blob/master/app/api/HelloApi.php): `app/api/HelloApi.php`
- [Middleware base](https://github.com/vanhaex/eslf/blob/master/framework/Middlewares/Middleware.php): `framework/Middlewares/Middleware.php`
- [Header middleware](https://github.com/vanhaex/eslf/blob/master/framework/Middlewares/SetHeadersMiddleware.php): `framework/Middlewares/SetHeadersMiddleware.php`
- [CSRF middleware](https://github.com/vanhaex/eslf/blob/master/framework/Middlewares/VerifyCSRFMiddleware.php): `framework/Middlewares/VerifyCSRFMiddleware.php`

### MVC and Data

- [Home controller](https://github.com/vanhaex/eslf/blob/master/app/controller/HomeController.php): `app/controller/HomeController.php`
- [Controller base](https://github.com/vanhaex/eslf/blob/master/framework/Controller.php): `framework/Controller.php`
- [Smarty rendering](https://github.com/vanhaex/eslf/blob/master/framework/View.php): `framework/View.php`
- [Page templates](https://github.com/vanhaex/eslf/blob/master/views/home.tpl): `views/home.tpl`
- [Database model](https://github.com/vanhaex/eslf/blob/master/framework/Model/Model.php): `framework/Model/Model.php`
- [Home model](https://github.com/vanhaex/eslf/blob/master/app/model/Home.php): `app/model/Home.php`
- [Database settings](https://github.com/vanhaex/eslf/blob/master/config/DatabaseConfig.php): `config/DatabaseConfig.php`

### Request Utilities

- [Application settings](https://github.com/vanhaex/eslf/blob/master/config/AppConfig.php): `config/AppConfig.php`
- [Input handling](https://github.com/vanhaex/eslf/blob/master/framework/InputUtility.php): `framework/InputUtility.php`
- [Session handling](https://github.com/vanhaex/eslf/blob/master/framework/SessionUtility.php): `framework/SessionUtility.php`
- [Logging](https://github.com/vanhaex/eslf/blob/master/framework/LogWriting.php): `framework/LogWriting.php`
- [Alert messages](https://github.com/vanhaex/eslf/blob/master/framework/AlertMessage/AlertMessage.php): `framework/AlertMessage/AlertMessage.php`
- [Smarty alert plugin](https://github.com/vanhaex/eslf/blob/master/smarty_plugins/function.add_alert_message.php): `smarty_plugins/function.add_alert_message.php`

### Framework Features

- [ESbuilder commands](https://github.com/vanhaex/eslf/tree/master/framework/Command): `framework/Command`

### Other components

- **Web client**
- **SQL database**
- **Developer**

## Connections

- Web client → HTTP entry point: sends request (evidence: `public/index.php`)
- HTTP entry point → Middleware base: runs middleware (evidence: `public/index.php`)
- HTTP entry point → Route configuration: loads routes (evidence: `public/index.php`)
- Route configuration → Router: registers routes (evidence: `config/RoutesConfig.php`)
- HTTP entry point → Router: dispatches request (evidence: `public/index.php`)
- Router → Route matching: matches route (evidence: `framework/Router.php`)
- Router → API dispatch: dispatches API (evidence: `framework/Router.php`)
- Middleware base → Header middleware: runs headers
- Middleware base → CSRF middleware: runs CSRF check
- Route matching → Home controller: invokes controller
- API dispatch → API endpoint: resolves endpoint (evidence: `framework/ApiController.php`)
- Home controller → Controller base: extends (evidence: `app/controller/HomeController.php`)
- Home controller → Smarty rendering: renders through
- Smarty rendering → Page templates: renders template (evidence: `README.md`)
- Home model → Database model: extends (evidence: `app/model/Home.php`)
- Database model → Database settings: reads settings (evidence: `framework/Model/Model.php`)
- Database model → SQL database: queries (evidence: `framework/Model/Model.php`)
- HTTP entry point → Input handling: reads request (evidence: `public/index.php`)
- Router → Input handling: cleans request (evidence: `framework/Router.php`)
- Session handling → Input handling: sanitizes session access (evidence: `framework/SessionUtility.php`)
- CSRF middleware → Input handling: checks submitted input (evidence: `framework/Middlewares/VerifyCSRFMiddleware.php`)
- Controller base → Application settings: checks settings (evidence: `framework/Controller.php`)
- Controller base → Logging: initializes logging (evidence: `framework/Controller.php`)
- Alert messages → Session handling: stores alerts (evidence: `framework/AlertMessage/AlertMessage.php`)
- Smarty alert plugin → Alert messages: uses alerts (evidence: `smarty_plugins/function.add_alert_message.php`)
- Developer → ESbuilder commands: runs commands (evidence: `README.md`)
