# ned3y2k/perminator architecture

> Architecture diagram of the GitHub repository ned3y2k/perminator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ned3y2k/perminator
- Repository: https://github.com/ned3y2k/perminator

## Overview

##### Main Components Identification

a. Core Framework Components:
- Request/Response Handling System
- MVC Architecture
- Database Layer
- API Processing System
- Security Layer
- Configuration System

b. Supporting Components:
- Console System
- Testing Framework
- Utility Services

**HTTP Request Entry Point**
**↓**
**Dispatcher Layer (src/classes/web/dispatch/*)**
**↓**
**Middleware/Interceptors (src/classes/web/IHandlerInterceptor.php)**

**Controller Layer (src/classes/web/mvc/*)**
**← → Context Management (src/classes/context/*)**
**← → View Layer (PageBuilder system)**
**← → Model Layer**

**Query Mapper System (src/classes/database/query/mapper/*)**
**↓**
**Database Connections (src/classes/database/*)**
**↓**
**Physical Database**

##### Detailed Component Breakdown

Database Layer:
**Query Mapper**
- Dynamic Query Builder
- Query Node System
- Database Statements

MVC Layer:
**Controllers**
- Action Controllers
- Exception Handlers
- Page Builders

Context Management:
**Application Context**
- Request Context
- Response Context
- User Session Context

##### Integration Points

Integration points for:
- External API connections
- SMS Integration (src/classes/sms/*)
- File System Interactions
- Session Management

##### Notes Section

Notes about:
- PHP 7.1 requirement
- mod_rewrite dependency
- Framework initialization flow
- Error handling patterns

Remember to emphasize the framework's flexibility by showing extension points and plugin architecture capabilities, as suggested by the "Easy & Flexible PHP Web Framework" description in the README.

This architectural representation will help developers understand both the high-level structure and the detailed component interactions within the Perminator framework.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Entry Point"
        Request["HTTP Request"]
        Response["HTTP Response"]
    end

    subgraph "Dispatcher Layer"
        Dispatch["Dispatcher System"]:::dispatch
        Interceptor["Handler Interceptors"]:::interceptor
    end

    subgraph "Core Processing"
        Controller["Controller Layer"]:::mvc
        Context["Context Management"]:::context
        View["View Layer (PageBuilder)"]:::mvc
        Model["Model Layer"]:::mvc
    end

    subgraph "Database Layer"
        QueryMapper["Query Mapper System"]:::database
        DBConn["Database Connections"]:::database
        PhysicalDB[(Physical Database)]:::database
    end

    subgraph "Supporting Systems"
        Security["Security Layer"]:::security
        API["API Processing"]:::api
        Console["Console System"]:::utility
        Testing["Testing Framework"]:::testing
        SMS["SMS Integration"]:::utility
        Exception["Exception Handling"]:::error
        Init["Initialization System"]:::utility
    end

    subgraph "Utility Layer"
        Utils["Utility Services"]:::utility
    end

    %% Main Flow
    Request --> Dispatch
    Dispatch --> Interceptor
    Interceptor --> Controller
    Controller --> Response

    %% Core Processing Relations
    Controller <--> Context
    Controller <--> View
    Controller <--> Model
    Model <--> QueryMapper
    QueryMapper --> DBConn
    DBConn --> PhysicalDB

    %% Supporting Systems Relations
    Controller --> API
    Controller --> Security
    Controller --> Exception
    Init -.-> Controller
    Controller -.-> SMS
    Controller -.-> Utils

    %% Testing Relations
    Testing -.-> Controller
    Testing -.-> API
    Console -.-> Controller

    %% Click Events
    click Dispatch "https://github.com/ned3y2k/perminator/tree/master/src/classes/web/dispatch"
    click Interceptor "https://github.com/ned3y2k/perminator/blob/master/src/classes/web/IHandlerInterceptor.php"
    click Controller "https://github.com/ned3y2k/perminator/tree/master/src/classes/web/mvc"
    click Context "https://github.com/ned3y2k/perminator/tree/master/src/classes/context"
    click QueryMapper "https://github.com/ned3y2k/perminator/tree/master/src/classes/database/query/mapper"
    click DBConn "https://github.com/ned3y2k/perminator/tree/master/src/classes/database"
    click Security "https://github.com/ned3y2k/perminator/tree/master/src/classes/security"
    click API "https://github.com/ned3y2k/perminator/tree/master/src/classes/api"
    click Console "https://github.com/ned3y2k/perminator/tree/master/src/classes/console"
    click Testing "https://github.com/ned3y2k/perminator/tree/master/src/classes/test"
    click Exception "https://github.com/ned3y2k/perminator/tree/master/src/classes/exception"
    click Init "https://github.com/ned3y2k/perminator/tree/master/src/classes/initializer"
    click SMS "https://github.com/ned3y2k/perminator/tree/master/src/classes/sms"
    click Utils "https://github.com/ned3y2k/perminator/tree/master/src/classes/util"

    %% Styling
    classDef mvc fill:#2196F3,stroke:#1565C0,color:white
    classDef database fill:#4CAF50,stroke:#2E7D32,color:white
    classDef security fill:#FF9800,stroke:#EF6C00,color:white
    classDef api fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef utility fill:#757575,stroke:#424242,color:white
    classDef testing fill:#00BCD4,stroke:#00838F,color:white
    classDef error fill:#F44336,stroke:#C62828,color:white
    classDef context fill:#3F51B5,stroke:#283593,color:white
    classDef dispatch fill:#009688,stroke:#00695C,color:white
    classDef interceptor fill:#795548,stroke:#4E342E,color:white
```
