# mcambal/http-smoke-test-crawler-sf architecture

> Architecture diagram of the GitHub repository mcambal/http-smoke-test-crawler-sf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mcambal/http-smoke-test-crawler-sf
- Repository: https://github.com/mcambal/http-smoke-test-crawler-sf

## Overview

##### Project type and purpose
- This is a full-stack PHP web application based on the Symfony “website-skeleton,” extended with a Dockerfile and docker-compose.yaml to containerize the web server, PHP runtime, and supporting services (database, mailer, etc.).
- It follows the classic MVC pattern with Doctrine ORM for data persistence, Twig for templating, Monolog for logging, and Symfony’s Service Container for dependency injection.

##### File structure
- Top-level Docker artifacts:
- Dockerfile (builds the PHP/Symfony container)
- docker-compose.yml (defines multi-container setup: app, database, maybe cache)
- config/: Symfony configuration (bundles, packages, routes, services)
- public/: web-root entry point (index.php, assets)
- src/: application code
- Controller/ (HTTP-entrypoint → actions)
- Entity/ (Doctrine entities)
- Repository/ (data access layer)
- Kernel.php (Symfony app bootstrap)
- templates/: Twig view layer
- migrations/: database migrations
- tests/: PHPUnit tests
- .env files: environment variables for each environment

##### Key technical stack (from composer.json & config files)
- PHP 8+, Symfony Framework
- Doctrine ORM & Migrations
- Twig templating
- Symfony Mailer & Notifier
- Monolog for logging
- (Optional) Caching adapters (filesystem, Redis)
- Docker + Docker-Compose orchestration

##### Main components
a. External actor: Browser or API client
b. Reverse Proxy / HTTP Server container (Apache or Nginx)
c. PHP-FPM container running the Symfony Application
– Symfony Kernel & front controller (public/index.php)
– Service Container (config/services.yaml)
– Controllers → Services → Repositories → Doctrine → Database
– Twig rendering layer
– Logger (Monolog)
– Mailer/Notifier service calls (SMTP or an external API)
d. Database container (MySQL, PostgreSQL)
e. (Optional) Cache container (Redis/Memcached)
f. Volumes & shared mounts (code volume, logs, cache)
g. Environment variables (.env, .env.test)
h. CI/Test runner (bin/phpunit)

##### Relationships and interactions
- HTTP Server → PHP-FPM (FastCGI)
- PHP-FPM → Symfony Kernel → Router → Controller
- Controller ↔ Service Layer ↔ Repository → Doctrine DBAL → Database
- Controller → returns Response → Twig templates (view) → HTTP Server → Browser
- Symfony services dispatch events (Notifier → external SMTP/API)
- Doctrine Migrations update Database schema
- PHPUnit tests load Kernel → run functional/unit tests against controllers/entities

##### Architectural patterns & design principles
- MVC separation: Controllers (input), Entities/Repositories (model), Twig (view)
- Dependency Injection via the Service Container
- Layered architecture: HTTP layer, Application logic layer, Persistence layer
- Configuration‐as‐code: all bundles, services, routes in YAML/PHP

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Artifacts" 
        DF["Dockerfile"]:::infra
        DC["docker-compose.yml"]:::infra
        ENV[".env / .env.test"]:::infra
    end

    User["Browser / API Client"]:::external

    subgraph "Docker Network"
        subgraph "Web Server Container"
            WS["Nginx/Apache"]:::web
        end
        subgraph "Symfony App Container"
            FC["public/index.php"]:::app
            K["Kernel & Bootstrap"]:::app
            SC["Service Container"]:::app
            Ctrl["Controller Layer"]:::app
            Repo["Repository Layer"]:::app
            Doct["Doctrine ORM"]:::app
            Twig["Twig Engine"]:::app
            Mon["Monolog"]:::app
            Mail["Mailer/Notifier"]:::app
        end
        subgraph "Database Container"
            DB["MySQL/PostgreSQL"]:::data
        end
        subgraph "Cache Container"
            Cache["Redis/Memcached"]:::cache
        end
    end

    subgraph "Additional Components"
        ROUTE["Routing Configs"]:::infra
        MIG["migrations/"]:::infra
        CONT["src/Controller/"]:::app
        ENT["src/Entity/"]:::app
        REP["src/Repository/"]:::app
        TPL["templates/"]:::infra
        TESTS["tests/"]:::infra
        BINPHPUNIT["bin/phpunit"]:::infra
    end

    User -->|"HTTP(S)"| WS
    WS -->|"FastCGI"| FC
    FC --> K
    K -->|"dispatch request"| Ctrl
    Ctrl --> SC
    SC --> Repo
    Repo --> Doct
    Doct --> DB
    Ctrl -->|"render"| Twig
    Twig --> WS
    WS --> User

    Ctrl --> Mail
    Mail -->|"SMTP/API"| ExtMail["External SMTP/API"]:::external

    SC -->|"cache get/set"| Cache

    click DF "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/Dockerfile"
    click DC "https://github.com/mcambal/http-smoke-test-crawler-sf/blob/master/docker-compose.yml"
    click ENV "https://github.com/mcambal/http-smoke-test-crawler-sf/blob/master/.env"
    click FC "https://github.com/mcambal/http-smoke-test-crawler-sf/blob/master/public/index.php"
    click K "https://github.com/mcambal/http-smoke-test-crawler-sf/blob/master/src/Kernel.php"
    click SC "https://github.com/mcambal/http-smoke-test-crawler-sf/blob/master/config/services.yaml"
    click ROUTE "https://github.com/mcambal/http-smoke-test-crawler-sf/blob/master/config/routes.yaml"
    click MIG "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/migrations/"
    click CONT "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/src/Controller/"
    click ENT "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/src/Entity/"
    click REP "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/src/Repository/"
    click TPL "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/templates/"
    click TESTS "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/tests/"
    click BINPHPUNIT "https://github.com/mcambal/http-smoke-test-crawler-sf/tree/master/bin/phpunit"

    classDef external fill:#cccccc,stroke:#666666,color:#000000;
    classDef web fill:#ccffcc,stroke:#33aa33,color:#000000;
    classDef app fill:#cce5ff,stroke:#3399ff,color:#000000;
    classDef data fill:#ffebcc,stroke:#ff9900,color:#000000;
    classDef cache fill:#e0f7fa,stroke:#00796b,color:#000000;
    classDef infra fill:#f3e5f5,stroke:#8e24aa,color:#000000;
```
