# nes-di/todolist-php architecture

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

- Interactive diagram: https://gitdiagram.com/nes-di/todolist-php
- Repository: https://github.com/nes-di/todolist-php

## Overview

This is a PHP task-list application with a browser workflow for viewing tasks and submitting new ones. The sampled runtime loads tasks from MySQL, computes counts, and renders an HTML list; submissions are validated and inserted before redirecting back to the list. The README describes an earlier, in-memory teaching version, so the graph follows the provided source excerpts where they differ. The stylesheet is documented, but its implementation was not sampled; test and other unsampled behavior are omitted.

Main entry points: [`index.php`](https://github.com/nes-di/todolist-php/blob/main/index.php) (Task page), [`includes/entete.php`](https://github.com/nes-di/todolist-php/blob/main/includes/entete.php) (Page header), [`ajouter.php`](https://github.com/nes-di/todolist-php/blob/main/ajouter.php) (Add task handler), [`donnees.php`](https://github.com/nes-di/todolist-php/blob/main/donnees.php) (Task retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_list["Task page<br/>[index.php]"]
  node_header["Page header<br/>[entete.php]"]
  node_footer["Page footer<br/>[pied.php]"]
  node_styles["Page styles<br/>[style.css]"]
end

subgraph group_tasks["Task handling"]
  node_add["Add task handler<br/>[ajouter.php]"]
  node_task_data["Task retrieval<br/>[donnees.php]"]
  node_helpers["Task and HTML helpers<br/>[fonctions.php]"]
end

subgraph group_storage["Database access"]
  node_config["DB configuration<br/>[config.php]"]
  node_connection["PDO connection<br/>[connexion.php]"]
end

node_browser(("Browser user"))
node_mysql[("MySQL database")]

node_browser -->|"requests page"| node_list
node_list -->|"loads tasks"| node_task_data
node_list -->|"computes and escapes"| node_helpers
node_list -->|"includes"| node_header
node_list -->|"includes"| node_footer
node_list -->|"submits form"| node_add
node_header -->|"escapes title"| node_helpers
node_header -->|"loads stylesheet"| node_styles
node_task_data -->|"opens connection"| node_connection
node_task_data -->|"reads tasks"| node_mysql
node_add -->|"opens connection"| node_connection
node_add -->|"inserts task"| node_mysql
node_connection -->|"loads settings"| node_config

click node_list "https://github.com/nes-di/todolist-php/blob/main/index.php"
click node_header "https://github.com/nes-di/todolist-php/blob/main/includes/entete.php"
click node_footer "https://github.com/nes-di/todolist-php/blob/main/includes/pied.php"
click node_styles "https://github.com/nes-di/todolist-php/blob/main/assets/style.css"
click node_add "https://github.com/nes-di/todolist-php/blob/main/ajouter.php"
click node_task_data "https://github.com/nes-di/todolist-php/blob/main/donnees.php"
click node_helpers "https://github.com/nes-di/todolist-php/blob/main/fonctions.php"
click node_config "https://github.com/nes-di/todolist-php/blob/main/config.php"
click node_connection "https://github.com/nes-di/todolist-php/blob/main/connexion.php"

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_list,node_header,node_footer,node_styles,node_browser toneBlue
class node_add,node_task_data,node_helpers,node_mysql toneAmber
class node_config,node_connection toneMint
```

## Components

### Web interface

- [Task page](https://github.com/nes-di/todolist-php/blob/main/index.php): `index.php`
- [Page header](https://github.com/nes-di/todolist-php/blob/main/includes/entete.php): `includes/entete.php`
- [Page footer](https://github.com/nes-di/todolist-php/blob/main/includes/pied.php): `includes/pied.php`
- [Page styles](https://github.com/nes-di/todolist-php/blob/main/assets/style.css): `assets/style.css`

### Task handling

- [Add task handler](https://github.com/nes-di/todolist-php/blob/main/ajouter.php): `ajouter.php`
- [Task retrieval](https://github.com/nes-di/todolist-php/blob/main/donnees.php): `donnees.php`
- [Task and HTML helpers](https://github.com/nes-di/todolist-php/blob/main/fonctions.php): `fonctions.php`

### Database access

- [DB configuration](https://github.com/nes-di/todolist-php/blob/main/config.php): `config.php`
- [PDO connection](https://github.com/nes-di/todolist-php/blob/main/connexion.php): `connexion.php`

### Other components

- **Browser user**
- **MySQL database**

## Connections

- Browser user → Task page: requests page
- Task page → Task retrieval: loads tasks (evidence: `index.php`)
- Task page → Task and HTML helpers: computes and escapes (evidence: `index.php`)
- Task page → Page header: includes (evidence: `index.php`)
- Task page → Page footer: includes (evidence: `index.php`)
- Task page → Add task handler: submits form (evidence: `index.php`)
- Page header → Task and HTML helpers: escapes title (evidence: `includes/entete.php`)
- Page header → Page styles: loads stylesheet (evidence: `includes/entete.php`)
- Task retrieval → PDO connection: opens connection (evidence: `donnees.php`)
- Task retrieval → MySQL database: reads tasks (evidence: `donnees.php`)
- Add task handler → PDO connection: opens connection (evidence: `ajouter.php`)
- Add task handler → MySQL database: inserts task (evidence: `ajouter.php`)
- PDO connection → DB configuration: loads settings (evidence: `connexion.php`)
