How deepl/deepl-php works
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: DeepLClient.php DeepL client · Translator.php Translator · HttpClientWrapper.php HTTP wrapper · TranslateTextOptions.php Text options
Components 19
Translation workflows
- DeepL client
src/DeepLClient.php - Translator
src/Translator.php - Text options
src/TranslateTextOptions.php - Document options
src/TranslateDocumentOptions.php - Document minifier
src/DocumentMinifier.php - Text rephrasing
src/RephraseTextResult.php
Translation resources
- Language support
src/LanguageSupport.php - Glossaries
src/GlossaryUtils.php - Style rules
src/StyleRuleInfo.php - Translation memories
src/TranslationMemoryUtils.php
Client transport
- HTTP wrapper
src/HttpClientWrapper.php - Retry backoff
src/BackoffTimer.php
Results and metadata
- Usage data
src/Usage.php - Text result
src/TextResult.php - Document handle
src/DocumentHandle.php - Document status
src/DocumentStatus.php - TM job results
src/TranslationMemoryJob.php
Other components
- PHP application
- DeepL API
Connections 19
- 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