# mll-lab/php-utils architecture

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

- Interactive diagram: https://gitdiagram.com/mll-lab/php-utils
- Repository: https://github.com/mll-lab/php-utils

## Overview

##### Main Components
- Core Modules: Represent the overall library (“php-utils”) as the core container.
- Domain Utilities:
- Holidays Module (e.g., BavarianHolidays) – for managing and extending holiday data.
- CSV, Date, DNA, and String Utilities (classes like CSVArray, DateModification, DnaSequence, StringUtil) – general-purpose helper functions.
- Laboratory and Automation Specific Utilities:
- FluidXPlate Module – handling operations related to FluidX plate scanning and associated scalar classes.
- IlluminaSampleSheet Module – including separate submodules for V1 and V2 sample sheet formats.
- LightcyclerSampleSheet Module – for laboratory sample sheet processing.
- Microplate Module – including various coordinate systems, sectioning, and microplate set management.
- Tecan Module – consisting of several subdirectories for Basic and Custom Commands, Liquid Classes, Rack configurations, and Tecan Protocols.
- QxManager Module – handling sample sheet management related to Qx operations.
- PHPStan Integration:
- PHPStan extension and custom rules (inside PHPStan/ and the provided extension.neon and rules.neon) which integrate static analysis checks.

##### Relationships and Interactions
- All these modules reside under the “src” directory, implying they are loosely coupled but part of the same utility library.
- The integration with PHPStan should be shown as a supporting service that taps into specific utility functions or rules, indicated by a connection between the core library and the analysis tools.

##### Architectural Patterns
- Although it is a library rather than a full-stack application or microservice architecture, there is a clear modular design. Each submodule (e.g., IlluminaSampleSheet, Tecan, Microplate, etc.) is conceptually isolated.
- “separation of concerns”: each domain-specific utility is self-contained and reusable.
- The layered design (core utility functions, specialized domain libraries, and testing/integration layers) should be reflected.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Container
    LIB["php-utils Library"]:::core

    %% Core Utilities Subgraph
    subgraph "Core Utilities"
        HOL["Holidays Utility"]:::core
        CSV["CSV Utility"]:::core
        DAT["Date Utility"]:::core
        DNA["DNA Utility"]:::core
        STR["String Utility"]:::core
    end

    %% Laboratory & Automation Utilities Subgraph
    subgraph "Laboratory & Automation Utilities"
        FLUX["FluidXPlate Module"]:::domain
        FLUXS["FluidXPlate Scalars"]:::domain

        ILL["IlluminaSampleSheet Module"]:::domain
        ILL_V1["V1 Submodule"]:::domain
        ILL_V2["V2 Submodule"]:::domain

        LITE["LightcyclerSampleSheet Module"]:::domain

        MICRO["Microplate Module"]:::domain
        MICROSET["Microplate Sets"]:::domain
        MICROS["Microplate Scalars"]:::domain

        TEC["Tecan Module"]:::domain
        TECSCAN["TecanScanner Utilities"]:::domain

        QX["QxManager Module"]:::domain
    end

    %% PHPStan Integration Subgraph
    subgraph "PHPStan Integration"
        PHPSTAN["PHPStan Extensions"]:::integration
        EXTNEO["extension.neon"]:::integration
        RULENEO["rules.neon"]:::integration
        PHPNEO["phpstan.neon"]:::integration
    end

    %% Testing Framework
    TEST["Testing Suite"]:::test

    %% Internal connections within subgraphs
    %% FluidXPlate: link to Scalars
    FLUX -->|"uses"| FLUXS

    %% IlluminaSampleSheet internal breakdown
    ILL -->|"includes"| ILL_V1
    ILL -->|"includes"| ILL_V2

    %% Microplate internal breakdown
    MICRO -->|"manages"| MICROSET
    MICRO -->|"manages"| MICROS

    %% Connections between modules
    %% Core Utilities support Sample Sheet Parsing
    CSV -->|"uses"| ILL
    STR -->|"uses"| ILL

    %% Integration between Microplate and Tecan
    MICRO -->|"integrates"| TEC

    %% PHPStan analyzes the entire library
    PHPSTAN -->|"analyzes"| LIB

    %% Testing Suite tests all modules
    TEST -->|"tests"| HOL
    TEST -->|"tests"| CSV
    TEST -->|"tests"| DAT
    TEST -->|"tests"| DNA
    TEST -->|"tests"| STR
    TEST -->|"tests"| FLUX
    TEST -->|"tests"| ILL
    TEST -->|"tests"| LITE
    TEST -->|"tests"| MICRO
    TEST -->|"tests"| TEC
    TEST -->|"tests"| QX
    TEST -->|"tests"| PHPSTAN

    %% Connections for PHPStan configuration
    PHPSTAN -->|"config"| EXTNEO
    PHPSTAN -->|"config"| RULENEO
    PHPSTAN -->|"config"| PHPNEO

    %% Click Events
    click LIB "https://github.com/mll-lab/php-utils/tree/master/src/"
    click HOL "https://github.com/mll-lab/php-utils/blob/master/src/BavarianHolidays.php"
    click CSV "https://github.com/mll-lab/php-utils/blob/master/src/CSVArray.php"
    click DAT "https://github.com/mll-lab/php-utils/blob/master/src/DateModification.php"
    click DNA "https://github.com/mll-lab/php-utils/blob/master/src/DnaSequence.php"
    click STR "https://github.com/mll-lab/php-utils/blob/master/src/StringUtil.php"
    click FLUX "https://github.com/mll-lab/php-utils/tree/master/src/FluidXPlate/"
    click FLUXS "https://github.com/mll-lab/php-utils/tree/master/src/FluidXPlate/Scalars/"
    click ILL "https://github.com/mll-lab/php-utils/tree/master/src/IlluminaSampleSheet/"
    click ILL_V1 "https://github.com/mll-lab/php-utils/tree/master/src/IlluminaSampleSheet/V1/"
    click ILL_V2 "https://github.com/mll-lab/php-utils/tree/master/src/IlluminaSampleSheet/V2/"
    click LITE "https://github.com/mll-lab/php-utils/tree/master/src/LightcyclerSampleSheet/"
    click MICRO "https://github.com/mll-lab/php-utils/tree/master/src/Microplate/"
    click MICROSET "https://github.com/mll-lab/php-utils/tree/master/src/Microplate/MicroplateSet/"
    click MICROS "https://github.com/mll-lab/php-utils/tree/master/src/Microplate/Scalars/"
    click TEC "https://github.com/mll-lab/php-utils/tree/master/src/Tecan/"
    click TECSCAN "https://github.com/mll-lab/php-utils/tree/master/src/TecanScanner/"
    click QX "https://github.com/mll-lab/php-utils/tree/master/src/QxManager/"
    click PHPSTAN "https://github.com/mll-lab/php-utils/tree/master/src/PHPStan/"
    click EXTNEO "https://github.com/mll-lab/php-utils/blob/master/extension.neon"
    click RULENEO "https://github.com/mll-lab/php-utils/blob/master/rules.neon"
    click PHPNEO "https://github.com/mll-lab/php-utils/blob/master/phpstan.neon"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef domain fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef integration fill:#FFA07A,stroke:#000,stroke-width:1px;
    classDef test fill:#DDA0DD,stroke:#000,stroke-width:1px;
```
