# matiase93/obligatorio_php architecture

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

- Interactive diagram: https://gitdiagram.com/matiase93/obligatorio_php
- Repository: https://github.com/matiase93/obligatorio_php

## Overview

This is a PHP web application branded Jukebox, with a URL-dispatching entry point and user-facing pages. The visible workflow routes a request to a controller; the user controller supports account creation and renders a form, while the index controller renders the home page. User, session, database, and template components are represented where supported by the tree or excerpts. The README is empty, and the sampled code does not establish the full user-listing or login workflow, so those relationships are not inferred.

Main entry points: [`index.php`](https://github.com/matiase93/obligatorio_php/blob/master/index.php) (Web entry point), [`controladores/ctrl_usuario.php`](https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_usuario.php) (User controller), [`clases/template.php`](https://github.com/matiase93/obligatorio_php/blob/master/clases/template.php) (Template service), [`controladores/ctrl_index.php`](https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_index.php) (Home controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Request handling"]
  node_entry["Web entry point<br/>[index.php]"]
  node_router["Controller dispatcher<br/>[ctrl_index.php]"]
  node_index_controller["Home controller<br/>[ctrl_index.php]"]
  node_base_controller["Controller base<br/>[clase_base.php]"]
end

subgraph group_users["User and session"]
  node_user_controller["User controller<br/>[ctrl_usuario.php]"]
  node_auth["Login guard<br/>[auth.php]"]
  node_session["Session state<br/>[session.php]"]
  node_user_model["User model<br/>[usuario.php]"]
end

subgraph group_rendering["Rendering and data"]
  node_singleton["Singleton utility<br/>[Singleton.php]"]
  node_template_service["Template service<br/>[template.php]"]
  node_views["Page templates"]
  node_database_connector["Database connector<br/>[db.php]"]
  node_database_config["Database configuration<br/>[config.php]"]
end

node_visitor(("Browser visitor"))
node_database[("Jukebox database")]

node_visitor -->|"requests page"| node_entry
node_entry -->|"dispatches request"| node_router
node_entry -->|"loads connector"| node_database_connector
node_router -->|"loads fallback"| node_index_controller
node_router -->|"loads controller"| node_user_controller
node_index_controller -->|"renders home"| node_template_service
node_user_controller -->|"creates account"| node_user_model
node_user_controller -->|"renders form"| node_template_service
node_user_controller -->|"redirects after success"| node_index_controller
node_auth -->|"checks session"| node_session
node_auth -->|"redirects to login"| node_index_controller
node_template_service -->|"displays templates"| node_views
node_template_service -->|"reads template settings"| node_database_config
node_database_connector -->|"loads connection settings"| node_database_config
node_database_connector -->|"opens connection"| node_database
node_entry -->|"loads utility"| node_singleton

click node_entry "https://github.com/matiase93/obligatorio_php/blob/master/index.php"
click node_router "https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_index.php"
click node_index_controller "https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_index.php"
click node_user_controller "https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_usuario.php"
click node_auth "https://github.com/matiase93/obligatorio_php/blob/master/clases/auth.php"
click node_session "https://github.com/matiase93/obligatorio_php/blob/master/clases/session.php"
click node_user_model "https://github.com/matiase93/obligatorio_php/blob/master/clases/usuario.php"
click node_base_controller "https://github.com/matiase93/obligatorio_php/blob/master/clases/clase_base.php"
click node_singleton "https://github.com/matiase93/obligatorio_php/blob/master/clases/Singleton.php"
click node_template_service "https://github.com/matiase93/obligatorio_php/blob/master/clases/template.php"
click node_views "https://github.com/matiase93/obligatorio_php/tree/master/vistas"
click node_database_connector "https://github.com/matiase93/obligatorio_php/blob/master/db/db.php"
click node_database_config "https://github.com/matiase93/obligatorio_php/blob/master/config/config.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_entry,node_router,node_index_controller,node_base_controller,node_visitor toneBlue
class node_user_controller,node_auth,node_session,node_user_model,node_database toneAmber
class node_singleton,node_template_service,node_views,node_database_connector,node_database_config toneMint
```

## Components

### Request handling

- [Web entry point](https://github.com/matiase93/obligatorio_php/blob/master/index.php): `index.php`
- [Controller dispatcher](https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_index.php): `controladores/ctrl_index.php`
- [Home controller](https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_index.php): `controladores/ctrl_index.php`
- [Controller base](https://github.com/matiase93/obligatorio_php/blob/master/clases/clase_base.php): `clases/clase_base.php`

### User and session

- [User controller](https://github.com/matiase93/obligatorio_php/blob/master/controladores/ctrl_usuario.php): `controladores/ctrl_usuario.php`
- [Login guard](https://github.com/matiase93/obligatorio_php/blob/master/clases/auth.php): `clases/auth.php`
- [Session state](https://github.com/matiase93/obligatorio_php/blob/master/clases/session.php): `clases/session.php`
- [User model](https://github.com/matiase93/obligatorio_php/blob/master/clases/usuario.php): `clases/usuario.php`

### Rendering and data

- [Singleton utility](https://github.com/matiase93/obligatorio_php/blob/master/clases/Singleton.php): `clases/Singleton.php`
- [Template service](https://github.com/matiase93/obligatorio_php/blob/master/clases/template.php): `clases/template.php`
- [Page templates](https://github.com/matiase93/obligatorio_php/tree/master/vistas): `vistas`
- [Database connector](https://github.com/matiase93/obligatorio_php/blob/master/db/db.php): `db/db.php`
- [Database configuration](https://github.com/matiase93/obligatorio_php/blob/master/config/config.php): `config/config.php`

### Other components

- **Browser visitor**
- **Jukebox database**

## Connections

- Browser visitor → Web entry point: requests page
- Web entry point → Controller dispatcher: dispatches request (evidence: `index.php`)
- Web entry point → Database connector: loads connector (evidence: `index.php`)
- Controller dispatcher → Home controller: loads fallback (evidence: `controladores/ctrl_index.php`)
- Controller dispatcher → User controller: loads controller (evidence: `controladores/ctrl_index.php`)
- Home controller → Template service: renders home (evidence: `controladores/ctrl_index.php`)
- User controller → User model: creates account (evidence: `controladores/ctrl_usuario.php`)
- User controller → Template service: renders form (evidence: `controladores/ctrl_usuario.php`)
- User controller → Home controller: redirects after success (evidence: `controladores/ctrl_usuario.php`)
- Login guard → Session state: checks session (evidence: `clases/auth.php`)
- Login guard → Home controller: redirects to login (evidence: `clases/auth.php`)
- Template service → Page templates: displays templates (evidence: `clases/template.php`)
- Template service → Database configuration: reads template settings (evidence: `clases/template.php`)
- Database connector → Database configuration: loads connection settings (evidence: `db/db.php`)
- Database connector → Jukebox database: opens connection (evidence: `db/db.php`)
- Web entry point → Singleton utility: loads utility (evidence: `index.php`)
