Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Deepl Php Laravel Package

deeplcom/deepl-php

Official PHP client for the DeepL API. Translate text and documents with simple methods like translateText(), using your DeepL authentication key. Composer install, supports PHP 7.3+ with ongoing updates as the API evolves.

View on GitHub
Deep Wiki
Context7

deeplcom/deepl-php is the official PHP client for the DeepL API, making it easy to translate text and documents from your PHP applications using DeepL’s high-quality machine translation. Instantiate a DeepLClient with your API auth key and call straightforward methods like translateText() to get translated output.

Designed for modern PHP (7.3+), the library aims to cover all DeepL API capabilities and keeps pace as new features are introduced.

  • Simple setup via Composer (composer require deeplcom/deepl-php)
  • Translate text with translateText() and convenient result objects
  • Supports configuration options on the client for flexible usage
  • Officially maintained and aligned with DeepL API features
  • Compatible with PHP 7.3+ (recommend 8.1+ going forward)
Frequently asked questions about Deepl Php
How do I install deeplcom/deepl-php in a Laravel project?
Run `composer require deeplcom/deepl-php` in your project root. The package requires PHP 7.3+ (recommended: 8.1+). No additional Laravel-specific setup is needed beyond initializing the `DeepLClient` with your API key.
Can I use this package for real-time translations in a Laravel Livewire app?
Yes. Initialize the `DeepLClient` in your Livewire component and call `translateText()` directly. For performance, cache frequent translations using Laravel’s cache system or queue async jobs for heavy workloads.
What Laravel versions does deeplcom/deepl-php support?
The package works with Laravel 9/10+ and PHP 7.3+. For new projects, use PHP 8.1+ to align with DeepL’s recommended version. No Laravel-specific dependencies exist, so it’s framework-agnostic.
How do I handle API rate limits or cost management in production?
Monitor `billedCharacters` in responses and set budget alerts via DeepL’s usage API. Cache translations with `Illuminate/Cache` for repeated requests. For batch processing, use Laravel queues to avoid hitting rate limits.
Can I translate documents (PDFs, DOCX) with this package?
Yes. Use the `translateDocument()` method, which supports file uploads. For Laravel, pair it with Laravel Storage (e.g., S3) to handle file uploads/downloads. Async processing via Laravel Jobs is recommended for large files.
How do I mock DeepL responses for unit testing?
Use Mockery to stub the `DeepLClient` or record API responses with VCR (e.g., `vcr/vcr`). For Laravel, bind the client to an interface in the service container to swap implementations during tests.
Is there a way to integrate this with Laravel Scout for translated search?
Yes. Translate content before indexing with Scout by calling `translateText()` in your `toSearchableArray()` method. Store translations in a separate column or use Laravel’s attribute casting for dynamic translations.
How do I securely store my DeepL API key in Laravel?
Never hardcode keys. Use Laravel’s `.env` file (e.g., `DEEPL_API_KEY`) and access it via `config('services.deepl.key')`. Restrict file permissions and use environment variables in CI/CD pipelines.
What’s the best way to structure translations in a Laravel app?
Create a `TranslationService` facade wrapping `DeepLClient` for cleaner syntax (e.g., `Translation::translate($text, 'es')`). For dynamic content, use Laravel’s `eloquent.creating` event to auto-translate fields.
Are there alternatives to deeplcom/deepl-php for Laravel?
Other PHP DeepL clients exist (e.g., unofficial wrappers), but this is the **official** library with full API feature support and active maintenance. For Laravel, consider Google Translate’s API (`google/cloud-translate`) if DeepL’s pricing is prohibitive.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport