# subhashladumor1/laravel-ai-video architecture

> Architecture diagram of the GitHub repository subhashladumor1/laravel-ai-video, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/subhashladumor1/laravel-ai-video
- Repository: https://github.com/subhashladumor1/laravel-ai-video

## Overview

Laravel AI Video is a Laravel package for turning prompts or images into rendered videos, with direct driver operations and an asynchronous job option. Its documented composed workflow plans scenes, generates scene visuals and motion plus voice, then renders a video; templates and budget checks shape or constrain generation. The README documents these orchestration capabilities, but the composed driver and several subsystem implementations were not sampled, so their links follow documented behavior rather than inspected call sites.

Main entry points: [`src/Drivers/ComposedDriver.php`](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/ComposedDriver.php) (Composed Driver), [`src/VideoManager.php`](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/VideoManager.php) (Video Manager), [`src/Drivers/OpenAIDriver.php`](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/OpenAIDriver.php) (OpenAI Driver), [`src/Jobs/ProcessVideoJob.php`](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Jobs/ProcessVideoJob.php) (Queued Job)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Laravel Entry"]
  node_facade["AiVideo Facade<br/>[AiVideo.php]"]
  node_manager["Video Manager<br/>[VideoManager.php]"]
  node_job["Queued Job"]
  node_contract["Driver Contract<br/>[VideoDriver.php]"]
end

subgraph group_orchestration["Video Orchestration"]
  node_composed["Composed Driver<br/>[ComposedDriver.php]"]
  node_planner["Scene Planner<br/>[ScenePlanner.php]"]
  node_subtitles["Subtitles"]
end

subgraph group_generation["AI Generation"]
  node_openai["OpenAI Driver<br/>[OpenAIDriver.php]"]
  node_gemini["Gemini Driver<br/>[GeminiDriver.php]"]
  node_runway["Runway Driver<br/>[RunwayDriver.php]"]
  node_leonardo["Leonardo Driver<br/>[LeonardoDriver.php]"]
  node_voice["Voice Generator<br/>[VoiceGenerator.php]"]
end

subgraph group_output["Output"]
  node_renderer["Video Renderer<br/>[VideoRenderer.php]"]
  node_template["Video Templates<br/>[Template.php]"]
  node_reel["Instagram Reel"]
end

subgraph group_controls["Controls"]
  node_guarddriver["Guarded Driver"]
  node_guard["AI Guard Adapter"]
  node_config["Package Config<br/>[ai-video.php]"]
end

node_user(("User"))
node_openai_api{{"OpenAI API"}}
node_gemini_api{{"Gemini API"}}
node_runway_api{{"Runway API"}}
node_leonardo_api{{"Leonardo API"}}
node_ffmpeg{{"FFmpeg"}}
node_guard_service{{"Laravel AI Guard"}}
node_video["Generated Video"]

node_user -->|"requests generation"| node_facade
node_facade -->|"selects driver"| node_manager
node_manager -->|"reads settings"| node_config
node_manager -->|"creates driver"| node_composed
node_manager -->|"wraps driver"| node_guarddriver
node_user -.->|"dispatches job"| node_job
node_job -->|"resolves driver"| node_manager
node_job -.->|"checks and logs"| node_guard
node_guarddriver -.->|"checks budget"| node_guard
node_composed -->|"plans scenes"| node_planner
node_composed -->|"generates visuals"| node_openai
node_composed -->|"animates images"| node_runway
node_composed -->|"animates images"| node_leonardo
node_composed -->|"generates voice"| node_openai
node_composed -->|"renders scenes"| node_renderer
node_composed -->|"generates subtitles"| node_subtitles
node_planner -->|"requests scenes"| node_openai
node_planner -.->|"requests scenes"| node_gemini
node_voice -->|"requests speech"| node_openai
node_openai -->|"calls API"| node_openai_api
node_gemini -->|"calls API"| node_gemini_api
node_runway -->|"calls API"| node_runway_api
node_leonardo -->|"calls API"| node_leonardo_api
node_renderer -->|"concatenates clips"| node_ffmpeg
node_template -->|"implemented by"| node_reel
node_renderer -->|"writes output"| node_video

click node_facade "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Facades/AiVideo.php"
click node_manager "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/VideoManager.php"
click node_job "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Jobs/ProcessVideoJob.php"
click node_contract "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Contracts/VideoDriver.php"
click node_composed "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/ComposedDriver.php"
click node_planner "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/ScenePlanner.php"
click node_subtitles "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/SubtitleGenerator.php"
click node_openai "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/OpenAIDriver.php"
click node_gemini "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/GeminiDriver.php"
click node_runway "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/RunwayDriver.php"
click node_leonardo "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/LeonardoDriver.php"
click node_voice "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/VoiceGenerator.php"
click node_renderer "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/VideoRenderer.php"
click node_template "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Templates/Template.php"
click node_reel "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Templates/InstagramReelTemplate.php"
click node_guarddriver "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/GuardAwareVideoDriver.php"
click node_guard "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Support/AiGuardIntegration.php"
click node_config "https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Config/ai-video.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_facade,node_manager,node_job,node_contract,node_user toneBlue
class node_composed,node_planner,node_subtitles toneAmber
class node_openai,node_gemini,node_runway,node_leonardo,node_voice,node_openai_api,node_gemini_api,node_runway_api,node_leonardo_api toneMint
class node_renderer,node_template,node_reel toneRose
class node_guarddriver,node_guard,node_config,node_ffmpeg,node_guard_service,node_video toneIndigo
```

## Components

### Laravel Entry

- [AiVideo Facade](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Facades/AiVideo.php): `src/Facades/AiVideo.php`
- [Video Manager](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/VideoManager.php): `src/VideoManager.php`
- [Queued Job](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Jobs/ProcessVideoJob.php): `src/Jobs/ProcessVideoJob.php`
- [Driver Contract](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Contracts/VideoDriver.php): `src/Contracts/VideoDriver.php`

### Video Orchestration

- [Composed Driver](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/ComposedDriver.php): `src/Drivers/ComposedDriver.php`
- [Scene Planner](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/ScenePlanner.php): `src/ScenePlanner.php`
- [Subtitles](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/SubtitleGenerator.php): `src/SubtitleGenerator.php`

### AI Generation

- [OpenAI Driver](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/OpenAIDriver.php): `src/Drivers/OpenAIDriver.php`
- [Gemini Driver](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/GeminiDriver.php): `src/Drivers/GeminiDriver.php`
- [Runway Driver](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/RunwayDriver.php): `src/Drivers/RunwayDriver.php`
- [Leonardo Driver](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/LeonardoDriver.php): `src/Drivers/LeonardoDriver.php`
- [Voice Generator](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/VoiceGenerator.php): `src/VoiceGenerator.php`

### Output

- [Video Renderer](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/VideoRenderer.php): `src/VideoRenderer.php`
- [Video Templates](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Templates/Template.php): `src/Templates/Template.php`
- [Instagram Reel](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Templates/InstagramReelTemplate.php): `src/Templates/InstagramReelTemplate.php`

### Controls

- [Guarded Driver](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Drivers/GuardAwareVideoDriver.php): `src/Drivers/GuardAwareVideoDriver.php`
- [AI Guard Adapter](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Support/AiGuardIntegration.php): `src/Support/AiGuardIntegration.php`
- [Package Config](https://github.com/subhashladumor1/laravel-ai-video/blob/main/src/Config/ai-video.php): `src/Config/ai-video.php`

### Other components

- **User**
- **OpenAI API**
- **Gemini API**
- **Runway API**
- **Leonardo API**
- **FFmpeg**
- **Laravel AI Guard**
- **Generated Video**

## Connections

- User → AiVideo Facade: requests generation
- AiVideo Facade → Video Manager: selects driver
- Video Manager → Package Config: reads settings
- Video Manager → Composed Driver: creates driver
- Video Manager → Guarded Driver: wraps driver
- User → Queued Job: dispatches job
- Queued Job → Video Manager: resolves driver
- Queued Job → AI Guard Adapter: checks and logs
- Guarded Driver → AI Guard Adapter: checks budget
- Composed Driver → Scene Planner: plans scenes
- Composed Driver → OpenAI Driver: generates visuals
- Composed Driver → Runway Driver: animates images
- Composed Driver → Leonardo Driver: animates images
- Composed Driver → OpenAI Driver: generates voice
- Composed Driver → Video Renderer: renders scenes
- Composed Driver → Subtitles: generates subtitles
- Scene Planner → OpenAI Driver: requests scenes
- Scene Planner → Gemini Driver: requests scenes
- Voice Generator → OpenAI Driver: requests speech
- OpenAI Driver → OpenAI API: calls API
- Gemini Driver → Gemini API: calls API
- Runway Driver → Runway API: calls API
- Leonardo Driver → Leonardo API: calls API
- Video Renderer → FFmpeg: concatenates clips
- Video Templates → Instagram Reel: implemented by
- Video Renderer → Generated Video: writes output
