# cyve/url architecture

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

- Interactive diagram: https://gitdiagram.com/cyve/url
- Repository: https://github.com/cyve/url

## Overview

##### Main Components

a) Core Components:
- Url Class (Central Component)
- Path Handler
- Query Handler
- PSR-7 Integration (indicated by Psr7Trait)

b) Utility Components:
- Array Access Implementation
- Iterator Implementation
- Countable Implementation

**Top Layer (Public API):**
**┌─────────────────────────┐**
- Url Class        │
- ┘

**Middle Layer (Core Components):**
**┌────────┐ ┌────────┐ ┌──────────┐**
- Path  │ │ Query  │ │Psr7Trait │
- ┘ └────────┘ └──────────┘

**Bottom Layer (Utilities):**
**┌────────────┐ ┌──────────┐ ┌──────────┐**
- ArrayAccess │ │Iterator  │ │Countable │
- ┘ └──────────┘ └──────────┘

##### Relationship Indicators

- Double lines (⇒) for inheritance relationships

##### Component Details

For each component, show:
- Class/Interface name
- Key methods/properties (especially for Url class)
- Implementation relationships

##### Additional Elements

- Any abbreviations used

##### Notes for Implementation

- The library's focus on URL manipulation
- The separation of concerns between different URL components
- The utility implementations that enable array-like access
- PSR-7 compatibility through trait implementation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Main
        URL["Url Class"]
    end

    subgraph Core["Core Components"]
        Path["Path Handler"]
        Query["Query Handler"]
        PSR7["PSR-7 Integration"]
    end

    subgraph Utils["Utility Components"]
        ArrayAcc["Array Access"]
        Iterator["Iterator"]
        Count["Countable"]
    end

    %% Main relationships
    URL --> Path
    URL --> Query
    URL -.-> PSR7

    %% Utility relationships
    Path --> ArrayAcc
    Path --> Iterator
    Path --> Count
    Query --> ArrayAcc
    Query --> Iterator
    Query --> Count

    %% Styling
    classDef main fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef utils fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef trait fill:#f1c40f,stroke:#f39c12,color:white

    class URL main
    class Path,Query core
    class PSR7 trait
    class ArrayAcc,Iterator,Count utils

    %% Click events
    click URL "https://github.com/cyve/url/blob/master/src/Url.php"
    click Path "https://github.com/cyve/url/blob/master/src/Path.php"
    click Query "https://github.com/cyve/url/blob/master/src/Query.php"
    click PSR7 "https://github.com/cyve/url/blob/master/src/Psr7Trait.php"
    click ArrayAcc "https://github.com/cyve/url/blob/master/src/Utils/ArrayAccess.php"
    click Iterator "https://github.com/cyve/url/blob/master/src/Utils/Iterator.php"
    click Count "https://github.com/cyve/url/blob/master/src/Utils/Countable.php"

    %% Legend
    subgraph Legend
        L1[Main Component]:::main
        L2[Core Component]:::core
        L3[Utility Component]:::utils
        L4[Trait]:::trait
    end
```
