PHPackages                             yardinternet/yard-deepl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yardinternet/yard-deepl

ActiveWordpress-plugin

yardinternet/yard-deepl
=======================

This plugin registers secure API endpoints that allows you to request translations directly from DeepL

v1.1.0(1y ago)11↓100%1[2 PRs](https://github.com/yardinternet/plugin-yard-deepl/pulls)PHPPHP ^8.0

Since Sep 20Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/yardinternet/plugin-yard-deepl)[ Packagist](https://packagist.org/packages/yardinternet/yard-deepl)[ Docs](https://www.yard.nl)[ RSS](/packages/yardinternet-yard-deepl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (9)Used By (0)

Yard DeepL
==========

[](#yard-deepl)

Author: Yard Digital Agency Author URI: Contributors: yarddigitalagency, mvdhoek1 License: EUPL v1.2 License URI: Requires at least: 6.0 Requires PHP: 8.0 Stable tag: 1.1.0 Tags: deepl, translating, secure Tested up to: 6.7.1

This plugin registers secure API endpoints that allow you to request translations directly from DeepL without exposing your DeepL API-key.

Description
-----------

[](#description)

This plugin registers secure API endpoints that allow you to request translations directly from DeepL without exposing your DeepL API-key. These endpoints are only accessible when a valid nonce is provided. When providing translations to website visitors, you can configure which languages are supported for translation.

Caching Mechanism
-----------------

[](#caching-mechanism)

Each object that is translated will store its cached translation in the `wp_postmeta` table within the database. This caching mechanism ensures that translations are efficiently reused, reducing unnecessary API requests to DeepL and saving costs.

- **Serving Cached Translations:** If a cached translation is newer than the `post_modified` date of the object, the cached version is served.
- **Fetching New Translations:** When the `post_modified` date of the object is more recent than the cached translation, a new translation is fetched from DeepL. Once retrieved, this translation is immediately cached for future use.

This approach minimizes the number of API calls to DeepL, ensuring translations are kept up to date only when necessary.

External Services
-----------------

[](#external-services)

This plugin connects to the DeepL API to provide translations for content.

- **Service:** DeepL API ()
- **Purpose:** To translate text from one language to another based on the provided target language.
- **Data Sent:** Text content for translation, the target language code, and the DeepL API key (handled securely and never exposed to users).
- **Conditions:** Data is sent when a request for translation is initiated.
- **Privacy Policy:** [DeepL Privacy Policy](https://www.deepl.com/privacy)
- **Terms of Service:** [DeepL Terms of Service](https://www.deepl.com/pro-license)

Installation
------------

[](#installation)

1. Upload plugin directory to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress

Development
-----------

[](#development)

The packages inside the `vendor` directory are namespace-prefixed. This is done by creating a new `vendor-prefixed` directory. After running `composer install`, this process happens automatically: the `vendor-prefixed` directory is generated on the fly, and the original `vendor` directory is deleted after installation.

If you need to work with development dependencies, follow these steps:

1. Run `composer install`. This will remove the `vendor` directory and create the `vendor-prefixed` directory.
2. Run `composer install --no-scripts`. The `--no-scripts` flag prevents the automatic deletion of the `vendor` directory, allowing you to work with the development dependencies. Ensure that the `vendor-prefixed` directory is still present, as the plug-in relies on it.

### Ready for releasing a new version?

[](#ready-for-releasing-a-new-version)

1. Run `composer install --optimize-autoloader`. This will optimize the autoloading rules by converting them into a class map, which improves performance and speeds up autoloading. It is particularly useful for production environments.

Usage
-----

[](#usage)

### Security

[](#security)

The API endpoints registered by this plugin are secured using a WordPress nonce. The nonce is passed to the front-end using the `wp_localize_script` function and is stored in a global JavaScript object `ydpl` which contains the following properties:

- `ydpl_translate_post_id`: The ID of the post to be translated.
- `ydpl_rest_translate_url`: The URL of the API endpoint for translation requests.
- `ydpl_supported_languages`: The list of languages supported for translation.
- `ydpl_api_request_nonce`: The nonce used for API validation.

When making requests to the API, ensure that the nonce is included in the request headers. The header should be named `nonce`, and it should contain the value of `ydpl_api_request_nonce`.

#### Example

[](#example)

##### Request

[](#request)

```
var xhr = new XMLHttpRequest();
xhr.open('POST', ydpl.ydpl_rest_translate_url, true);

// Set request headers
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('nonce', ydpl.ydpl_api_request_nonce);

// Handle response
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        console.log('Translation:', JSON.parse(xhr.responseText));
    } else if (xhr.readyState === 4) {
        console.error('Error:', xhr.statusText);
    }
};

// Prepare and send the request body
var data = JSON.stringify({
    text: ["Look another test"],
    target_lang: "DE"
});

xhr.send(data);
```

##### Response

[](#response)

```
[
    {
        "text": "Look another test!",
        "translation": "Sehen Sie sich einen weiteren Test an!"
    }
]
```

About us
--------

[](#about-us)

[![banner](https://raw.githubusercontent.com/yardinternet/.github/refs/heads/main/profile/assets/small-banner-github.svg)](https://www.yard.nl/werken-bij/)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance59

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~26 days

Total

6

Last Release

463d ago

Major Versions

v0.0.2 → v1.0.02024-10-18

PHP version history (2 changes)v0.0.1PHP ^7.4|^8.0

v1.0.1PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62775?v=4)[Anton Zhuravsky](/maintainers/Yard)[@yard](https://github.com/yard)

---

Top Contributors

[![FreakyWizard](https://avatars.githubusercontent.com/u/114140418?v=4)](https://github.com/FreakyWizard "FreakyWizard (2 commits)")

---

Tags

deeplphpphp8wordpress-plugin

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/yardinternet-yard-deepl/health.svg)

```
[![Health](https://phpackages.com/badges/yardinternet-yard-deepl/health.svg)](https://phpackages.com/packages/yardinternet-yard-deepl)
```

###  Alternatives

[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M381](/packages/respect-validation)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[zbateson/mail-mime-parser

MIME email message parser

53949.2M79](/packages/zbateson-mail-mime-parser)[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)[infinum/eightshift-libs

WordPress libs developed by Eightshift team to use in modern WordPress.

63118.9k3](/packages/infinum-eightshift-libs)[rareloop/lumberjack-core

A powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code

42155.0k19](/packages/rareloop-lumberjack-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
