# williamsdb/php2bluesky architecture

> Architecture diagram of the GitHub repository williamsdb/php2bluesky, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/williamsdb/php2bluesky
- Repository: https://github.com/williamsdb/php2bluesky

## Overview

##### Project Type Analysis
This is a PHP library project that serves as a wrapper/interface for posting content to Bluesky's API. It's a relatively simple but focused tool that handles specific functionality (posting text and images to Bluesky).

##### Main Components

A. Core Components:
- PHP Library (php2Bluesky)
- External BlueskyAPI Dependency
- Bluesky Platform

B. Functional Components:
- Authentication Handler
- Media Upload Handler
- Post Creation Handler
- API Communication Layer

- [Client Application]
- ↓
- [php2Bluesky Library]
- ↓
- [BlueskyAPI (External)]
- ↓
- [Bluesky Platform]

##### Specific Elements

**[Client Code]**
- ↓
**[php2Bluesky Library]**
- Authentication Handler
- (handle + password management)
- Media Upload Handler
- (image processing & upload)
- Post Creator
- (text + media composition)
- ↓
**[BlueskyAPI Integration Layer]**
- ↓
**[Bluesky Platform]**

##### Implementation Notes

- Simple, modular design
- Clear separation between library components
- Dependency flow
- API integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef client fill:#e1f5fe,stroke:#01579b
    classDef core fill:#e8f5e9,stroke:#1b5e20
    classDef dependency fill:#fff3e0,stroke:#e65100
    classDef external fill:#f3e5f5,stroke:#4a148c
    classDef feature fill:#fafafa,stroke:#424242

    %% Features & Requirements Section
    subgraph Features
        F1["Text Posts"]:::feature
        F2["Image Posts"]:::feature
        F3["Multi-image Posts"]:::feature
    end

    %% Client Application Layer
    CA["Client PHP Application"]:::client

    %% Core Library Layer
    subgraph CoreLib
        FM["Functions Module"]:::core
        EI["Example Implementation"]:::core
        
        %% Core Functions
        CF1["bluesky_connect()"]:::core
        CF2["post_to_bluesky()"]:::core
        CF3["upload_media_to_bluesky()"]:::core
    end

    %% Dependencies Layer
    subgraph Dependencies
        D1["BlueskyApi\n(cjrasmussen/bluesky-api)"]:::dependency
        D2["PHP DOM Extension"]:::dependency
        D3["PHP GD Extension"]:::dependency
    end

    %% External Services Layer
    subgraph External
        BS["Bluesky API Service"]:::external
        RI["Remote Image Sources"]:::external
    end

    %% Connections
    Features --> CA
    CA --> FM
    CA --> EI
    FM --> CF1 & CF2 & CF3
    CF1 & CF2 & CF3 --> D1
    D1 -.-> BS
    CF3 -.-> RI
    D2 & D3 --> CF3

    %% Click Events
    click FM "https://github.com/williamsdb/php2Bluesky/blob/main/src/functions.php"
    click EI "https://github.com/williamsdb/php2Bluesky/blob/main/src/example.php"

    %% Legend
    subgraph Legend
        L1[" "]:::client
        L2[" "]:::core
        L3[" "]:::dependency
        L4[" "]:::external
        L5[" "]:::feature
        L6["--- Direct Call"]
        L7["-.- API Request"]
    end
```
