# deepl/deepl-php architecture

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

- Interactive diagram: https://gitdiagram.com/deepl/deepl-php
- Repository: https://github.com/deepl/deepl-php

## Overview

deepl-php is an official PHP client library for calling DeepL’s translation API. An application constructs a DeepLClient and submits text or documents with language and translation options; the library sends requests to DeepL and returns translation results or document status and output. The client also exposes language and usage information, glossary and style-rule management, rephrasing, and translation-memory operations. Sampled code supports the Translator-to-HTTP transport and document-minification paths; several other capabilities are documented or represented in the tree, but their internal wiring was not sampled.

Main entry points: [`src/DeepLClient.php`](https://github.com/deepl/deepl-php/blob/main/src/DeepLClient.php) (DeepL client), [`src/Translator.php`](https://github.com/deepl/deepl-php/blob/main/src/Translator.php) (Translator), [`src/HttpClientWrapper.php`](https://github.com/deepl/deepl-php/blob/main/src/HttpClientWrapper.php) (HTTP wrapper), [`src/TranslateTextOptions.php`](https://github.com/deepl/deepl-php/blob/main/src/TranslateTextOptions.php) (Text options)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_translation["Translation workflows"]
  node_client["DeepL client<br/>[DeepLClient.php]"]
  node_translator["Translator<br/>[Translator.php]"]
  node_text_options["Text options"]
  node_document_options["Document options"]
  node_minifier["Document minifier"]
  node_rephrase["Text rephrasing"]
end

subgraph group_resources["Translation resources"]
  node_languages["Language support"]
  node_glossaries["Glossaries<br/>[GlossaryUtils.php]"]
  node_styles["Style rules<br/>[StyleRuleInfo.php]"]
  node_memories["Translation memories"]
end

subgraph group_transport["Client transport"]
  node_http["HTTP wrapper"]
  node_backoff["Retry backoff<br/>[BackoffTimer.php]"]
end

subgraph group_models["Results and metadata"]
  node_usage["Usage data<br/>[Usage.php]"]
  node_text_result["Text result<br/>[TextResult.php]"]
  node_document_handle["Document handle<br/>[DocumentHandle.php]"]
  node_document_status["Document status<br/>[DocumentStatus.php]"]
  node_tm_job["TM job results"]
end

node_application(("PHP application"))
node_deepl_api{{"DeepL API"}}

node_application -->|"calls"| node_client
node_client -->|"translation calls"| node_translator
node_translator -->|"uses options"| node_text_options
node_translator -->|"sends requests"| node_http
node_translator -->|"minifies documents"| node_minifier
node_http -->|"retries with"| node_backoff
node_http -->|"sends HTTP"| node_deepl_api
node_deepl_api -->|"returns responses"| node_http
node_translator -->|"returns"| node_text_result
node_translator -->|"returns"| node_document_handle
node_translator -->|"returns"| node_document_status
node_client -->|"accepts options"| node_document_options
node_client -->|"language operations"| node_languages
node_client -->|"glossary operations"| node_glossaries
node_client -->|"style operations"| node_styles
node_client -->|"memory operations"| node_memories
node_client -->|"returns results"| node_rephrase
node_client -->|"returns usage"| node_usage
node_client -->|"returns job data"| node_tm_job

click node_client "https://github.com/deepl/deepl-php/blob/main/src/DeepLClient.php"
click node_translator "https://github.com/deepl/deepl-php/blob/main/src/Translator.php"
click node_text_options "https://github.com/deepl/deepl-php/blob/main/src/TranslateTextOptions.php"
click node_document_options "https://github.com/deepl/deepl-php/blob/main/src/TranslateDocumentOptions.php"
click node_minifier "https://github.com/deepl/deepl-php/blob/main/src/DocumentMinifier.php"
click node_http "https://github.com/deepl/deepl-php/blob/main/src/HttpClientWrapper.php"
click node_backoff "https://github.com/deepl/deepl-php/blob/main/src/BackoffTimer.php"
click node_languages "https://github.com/deepl/deepl-php/blob/main/src/LanguageSupport.php"
click node_glossaries "https://github.com/deepl/deepl-php/blob/main/src/GlossaryUtils.php"
click node_styles "https://github.com/deepl/deepl-php/blob/main/src/StyleRuleInfo.php"
click node_memories "https://github.com/deepl/deepl-php/blob/main/src/TranslationMemoryUtils.php"
click node_rephrase "https://github.com/deepl/deepl-php/blob/main/src/RephraseTextResult.php"
click node_usage "https://github.com/deepl/deepl-php/blob/main/src/Usage.php"
click node_text_result "https://github.com/deepl/deepl-php/blob/main/src/TextResult.php"
click node_document_handle "https://github.com/deepl/deepl-php/blob/main/src/DocumentHandle.php"
click node_document_status "https://github.com/deepl/deepl-php/blob/main/src/DocumentStatus.php"
click node_tm_job "https://github.com/deepl/deepl-php/blob/main/src/TranslationMemoryJob.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_client,node_translator,node_text_options,node_document_options,node_minifier,node_rephrase toneBlue
class node_languages,node_glossaries,node_styles,node_memories toneAmber
class node_http,node_backoff,node_deepl_api toneMint
class node_usage,node_text_result,node_document_handle,node_document_status,node_tm_job toneRose
class node_application toneIndigo
```

## Components

### Translation workflows

- [DeepL client](https://github.com/deepl/deepl-php/blob/main/src/DeepLClient.php): `src/DeepLClient.php`
- [Translator](https://github.com/deepl/deepl-php/blob/main/src/Translator.php): `src/Translator.php`
- [Text options](https://github.com/deepl/deepl-php/blob/main/src/TranslateTextOptions.php): `src/TranslateTextOptions.php`
- [Document options](https://github.com/deepl/deepl-php/blob/main/src/TranslateDocumentOptions.php): `src/TranslateDocumentOptions.php`
- [Document minifier](https://github.com/deepl/deepl-php/blob/main/src/DocumentMinifier.php): `src/DocumentMinifier.php`
- [Text rephrasing](https://github.com/deepl/deepl-php/blob/main/src/RephraseTextResult.php): `src/RephraseTextResult.php`

### Translation resources

- [Language support](https://github.com/deepl/deepl-php/blob/main/src/LanguageSupport.php): `src/LanguageSupport.php`
- [Glossaries](https://github.com/deepl/deepl-php/blob/main/src/GlossaryUtils.php): `src/GlossaryUtils.php`
- [Style rules](https://github.com/deepl/deepl-php/blob/main/src/StyleRuleInfo.php): `src/StyleRuleInfo.php`
- [Translation memories](https://github.com/deepl/deepl-php/blob/main/src/TranslationMemoryUtils.php): `src/TranslationMemoryUtils.php`

### Client transport

- [HTTP wrapper](https://github.com/deepl/deepl-php/blob/main/src/HttpClientWrapper.php): `src/HttpClientWrapper.php`
- [Retry backoff](https://github.com/deepl/deepl-php/blob/main/src/BackoffTimer.php): `src/BackoffTimer.php`

### Results and metadata

- [Usage data](https://github.com/deepl/deepl-php/blob/main/src/Usage.php): `src/Usage.php`
- [Text result](https://github.com/deepl/deepl-php/blob/main/src/TextResult.php): `src/TextResult.php`
- [Document handle](https://github.com/deepl/deepl-php/blob/main/src/DocumentHandle.php): `src/DocumentHandle.php`
- [Document status](https://github.com/deepl/deepl-php/blob/main/src/DocumentStatus.php): `src/DocumentStatus.php`
- [TM job results](https://github.com/deepl/deepl-php/blob/main/src/TranslationMemoryJob.php): `src/TranslationMemoryJob.php`

### Other components

- **PHP application**
- **DeepL API**

## Connections

- PHP application → DeepL client: calls
- DeepL client → Translator: translation calls
- Translator → Text options: uses options
- Translator → HTTP wrapper: sends requests
- Translator → Document minifier: minifies documents
- HTTP wrapper → Retry backoff: retries with
- HTTP wrapper → DeepL API: sends HTTP
- DeepL API → HTTP wrapper: returns responses
- Translator → Text result: returns
- Translator → Document handle: returns
- Translator → Document status: returns
- DeepL client → Document options: accepts options
- DeepL client → Language support: language operations
- DeepL client → Glossaries: glossary operations
- DeepL client → Style rules: style operations
- DeepL client → Translation memories: memory operations
- DeepL client → Text rephrasing: returns results
- DeepL client → Usage data: returns usage
- DeepL client → TM job results: returns job data
