# fabiojr933/appxml architecture

> Architecture diagram of the GitHub repository fabiojr933/appxml, 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/fabiojr933/appxml
- Repository: https://github.com/fabiojr933/appxml

## Overview

AppXml is a small PHP web application for replacing the recipient CNPJ in an uploaded NFe XML and returning the modified file for download. Its documented workflow is upload, update the destination CNPJ, generate the output XML, and download it. The controller excerpt shows the file operations; the README describes the user-facing workflow. Routing details beyond the front controller are not established by the available excerpts.

Main entry points: [`app/controllers/HomeController.php`](https://github.com/fabiojr933/appxml/blob/master/app/controllers/HomeController.php) (Home controller), [`app/views/template.php`](https://github.com/fabiojr933/appxml/blob/master/app/views/template.php) (Page template), [`app/core/Core.php`](https://github.com/fabiojr933/appxml/blob/master/app/core/Core.php) (Request router), [`app/core/Model.php`](https://github.com/fabiojr933/appxml/blob/master/app/core/Model.php) (Database model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_page["Home page<br/>[home.php]"]
  node_layout["Page template<br/>[template.php]"]
end

subgraph group_xml["XML conversion"]
  node_home["Home controller<br/>[HomeController.php]"]
  node_original["Uploaded XML"]
  node_transform["CNPJ replacement<br/>[HomeController.php]"]
  node_final["Generated XML"]
end

subgraph group_framework["PHP framework"]
  node_front["Front controller<br/>[index.php]"]
  node_router["Request router<br/>[Core.php]"]
  node_controller["View controller<br/>[Controller.php]"]
  node_config["Application config<br/>[config.php]"]
  node_connection["Database connection<br/>[Conexao.php]"]
  node_model["Database model<br/>[Model.php]"]
  node_dao["Data access<br/>[Dao.php]"]
  node_service["Data services<br/>[Service.php]"]
  node_flash["Session messages<br/>[Flash.php]"]
  node_validation["Validation<br/>[Validacao.php]"]
  node_validation_item["Validation rules<br/>[ValidacaoItem.php]"]
  node_exception["Exception handling<br/>[Excecao.php]"]
  node_utility["Upload utilities<br/>[UtilService.php]"]
  node_helpers["Shared helpers"]
end

node_user(("User"))

node_user -->|"submits XML"| node_home
node_front -->|"runs"| node_router
node_router -.->|"dispatches"| node_home
node_home -->|"loads page"| node_layout
node_layout -->|"renders"| node_page
node_home -->|"stores upload"| node_original
node_home -->|"updates CNPJ"| node_transform
node_transform -->|"reads XML"| node_original
node_transform -->|"writes XML"| node_final
node_home -->|"downloads file"| node_user
node_controller -->|"reads messages"| node_flash
node_dao -->|"delegates queries"| node_model
node_model -->|"gets connection"| node_connection
node_service -->|"delegates data access"| node_dao
node_validation -->|"uses rules"| node_validation_item

click node_front "https://github.com/fabiojr933/appxml/blob/master/index.php"
click node_router "https://github.com/fabiojr933/appxml/blob/master/app/core/Core.php"
click node_home "https://github.com/fabiojr933/appxml/blob/master/app/controllers/HomeController.php"
click node_page "https://github.com/fabiojr933/appxml/blob/master/app/views/home.php"
click node_layout "https://github.com/fabiojr933/appxml/blob/master/app/views/template.php"
click node_original "https://github.com/fabiojr933/appxml/tree/master/xml_original"
click node_transform "https://github.com/fabiojr933/appxml/blob/master/app/controllers/HomeController.php"
click node_final "https://github.com/fabiojr933/appxml/tree/master/xml_final"
click node_controller "https://github.com/fabiojr933/appxml/blob/master/app/core/Controller.php"
click node_config "https://github.com/fabiojr933/appxml/blob/master/config/config.php"
click node_connection "https://github.com/fabiojr933/appxml/blob/master/app/core/Conexao.php"
click node_model "https://github.com/fabiojr933/appxml/blob/master/app/core/Model.php"
click node_dao "https://github.com/fabiojr933/appxml/blob/master/app/models/dao/Dao.php"
click node_service "https://github.com/fabiojr933/appxml/blob/master/app/models/service/Service.php"
click node_flash "https://github.com/fabiojr933/appxml/blob/master/app/core/Flash.php"
click node_validation "https://github.com/fabiojr933/appxml/blob/master/app/core/Validacao.php"
click node_validation_item "https://github.com/fabiojr933/appxml/blob/master/app/core/ValidacaoItem.php"
click node_exception "https://github.com/fabiojr933/appxml/blob/master/app/core/Excecao.php"
click node_utility "https://github.com/fabiojr933/appxml/blob/master/app/util/UtilService.php"
click node_helpers "https://github.com/fabiojr933/appxml/tree/master/app/helper"

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_page,node_layout,node_user toneBlue
class node_home,node_original,node_transform,node_final toneAmber
class node_front,node_router,node_controller,node_config,node_connection,node_model,node_dao,node_service,node_flash,node_validation,node_validation_item,node_exception,node_utility,node_helpers toneMint
```

## Components

### Web interface

- [Home page](https://github.com/fabiojr933/appxml/blob/master/app/views/home.php): `app/views/home.php`
- [Page template](https://github.com/fabiojr933/appxml/blob/master/app/views/template.php): `app/views/template.php`

### XML conversion

- [Home controller](https://github.com/fabiojr933/appxml/blob/master/app/controllers/HomeController.php): `app/controllers/HomeController.php`
- [Uploaded XML](https://github.com/fabiojr933/appxml/tree/master/xml_original): `xml_original`
- [CNPJ replacement](https://github.com/fabiojr933/appxml/blob/master/app/controllers/HomeController.php): `app/controllers/HomeController.php`
- [Generated XML](https://github.com/fabiojr933/appxml/tree/master/xml_final): `xml_final`

### PHP framework

- [Front controller](https://github.com/fabiojr933/appxml/blob/master/index.php): `index.php`
- [Request router](https://github.com/fabiojr933/appxml/blob/master/app/core/Core.php): `app/core/Core.php`
- [View controller](https://github.com/fabiojr933/appxml/blob/master/app/core/Controller.php): `app/core/Controller.php`
- [Application config](https://github.com/fabiojr933/appxml/blob/master/config/config.php): `config/config.php`
- [Database connection](https://github.com/fabiojr933/appxml/blob/master/app/core/Conexao.php): `app/core/Conexao.php`
- [Database model](https://github.com/fabiojr933/appxml/blob/master/app/core/Model.php): `app/core/Model.php`
- [Data access](https://github.com/fabiojr933/appxml/blob/master/app/models/dao/Dao.php): `app/models/dao/Dao.php`
- [Data services](https://github.com/fabiojr933/appxml/blob/master/app/models/service/Service.php): `app/models/service/Service.php`
- [Session messages](https://github.com/fabiojr933/appxml/blob/master/app/core/Flash.php): `app/core/Flash.php`
- [Validation](https://github.com/fabiojr933/appxml/blob/master/app/core/Validacao.php): `app/core/Validacao.php`
- [Validation rules](https://github.com/fabiojr933/appxml/blob/master/app/core/ValidacaoItem.php): `app/core/ValidacaoItem.php`
- [Exception handling](https://github.com/fabiojr933/appxml/blob/master/app/core/Excecao.php): `app/core/Excecao.php`
- [Upload utilities](https://github.com/fabiojr933/appxml/blob/master/app/util/UtilService.php): `app/util/UtilService.php`
- [Shared helpers](https://github.com/fabiojr933/appxml/tree/master/app/helper): `app/helper`

### Other components

- **User**

## Connections

- User → Home controller: submits XML (evidence: `README.md`)
- Front controller → Request router: runs (evidence: `index.php`)
- Request router → Home controller: dispatches
- Home controller → Page template: loads page (evidence: `app/controllers/HomeController.php`)
- Page template → Home page: renders (evidence: `app/views/template.php`)
- Home controller → Uploaded XML: stores upload (evidence: `app/controllers/HomeController.php`)
- Home controller → CNPJ replacement: updates CNPJ (evidence: `app/controllers/HomeController.php`)
- CNPJ replacement → Uploaded XML: reads XML (evidence: `app/controllers/HomeController.php`)
- CNPJ replacement → Generated XML: writes XML (evidence: `app/controllers/HomeController.php`)
- Home controller → User: downloads file (evidence: `app/controllers/HomeController.php`)
- View controller → Session messages: reads messages (evidence: `app/core/Controller.php`)
- Data access → Database model: delegates queries (evidence: `app/models/dao/Dao.php`)
- Database model → Database connection: gets connection (evidence: `app/core/Model.php`)
- Data services → Data access: delegates data access (evidence: `app/models/service/Service.php`)
- Validation → Validation rules: uses rules (evidence: `app/core/Validacao.php`)
