# piyas33/push-notification architecture

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

- Interactive diagram: https://gitdiagram.com/piyas33/push-notification
- Repository: https://github.com/piyas33/push-notification

## Overview

##### Main Components Identification
The project is a Laravel package for handling push notifications through Firebase Cloud Messaging. The key components to represent are:

- Package Core (PushNotification.php)
- Service Provider Layer
- Service Layer
- Queue System
- Firebase Cloud Messaging (External Service)
- Configuration Management
- Job Processing System

##### Flow Representation

- Laravel Application
- ↓
- PushNotificationServiceProvider
- ↓
- PushNotification (Facade)
- ↓
- PushNotificationService
- ↓
- [Queue System (Optional)] → PushNotificationJob
- ↓
- Firebase Cloud Messaging

##### Important Elements

a. Configuration Flow:
- Fcm_config.php connecting to the service layer
- Environment variables input

b. Queue System (Conditional):
- Alternative paths based on FCM_ENABLE_QUEUE setting
- Direct path when queue is disabled
- Queue-based path when enabled

##### Additional Details

Annotations for:
- Required environment variables
- Queue configuration options
- Service registration points
- Firebase credential requirements

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Laravel
        LA[Laravel Application]
    end

    subgraph Package
        SP["Service Provider"]:::provider
        PNF["Push Notification Facade"]:::core
        PNS["Push Notification Service"]:::service
        Config["FCM Configuration"]:::config
        
        subgraph Queue ["Queue System (Optional)"]
            QS["Queue Storage"]:::queue
            PNJ["Push Notification Job"]:::job
        end
    end

    subgraph External
        FCM["Firebase Cloud Messaging"]:::external
    end

    %% Connections
    LA --> SP
    SP --> PNF
    PNF --> PNS
    Config --> PNS
    
    %% Queue paths
    PNS --> |Queue Enabled| QS
    QS --> PNJ
    PNJ --> FCM
    PNS --> |Queue Disabled| FCM

    %% Styling
    classDef provider fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef service fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef queue fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef job fill:#E6E6FA,stroke:#333,stroke-width:2px
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% Click events
    click SP "https://github.com/piyas33/push-notification/blob/main/src/PushNotificationServiceProvider.php"
    click PNF "https://github.com/piyas33/push-notification/blob/main/src/PushNotification.php"
    click PNS "https://github.com/piyas33/push-notification/blob/main/src/Services/PushNotificationService.php"
    click PNJ "https://github.com/piyas33/push-notification/blob/main/src/Jobs/PushNotificationJob.php"
    click Config "https://github.com/piyas33/push-notification/blob/main/src/config/fcm_config.php"

    %% Legend
    subgraph Legend
        L1["Service Provider"]:::provider
        L2["Core Component"]:::core
        L3["Service Layer"]:::service
        L4["Queue Component"]:::queue
        L5["Job Processing"]:::job
        L6["External Service"]:::external
        L7["Configuration"]:::config
    end
```
