Download the PHP package mistralys/deepl-xml-translator without Composer
On this page you can find all versions of the php package mistralys/deepl-xml-translator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mistralys/deepl-xml-translator
More information about mistralys/deepl-xml-translator
Files in mistralys/deepl-xml-translator
Package deepl-xml-translator
Short Description DeepL XML Translator.
License GPL-3.0-or-later
Informations about the package deepl-xml-translator
DeepL XML Translator
This is a drop-in PHP helper class that can translate a bundle of strings, which may contain markup. It uses DeepL's XML translation feature, and is designed to be very easy to use.
Installation
Simply require the package in your project via Composer:
See the packagist page: https://packagist.org/packages/mistralys/deepl-xml-translator
Usage
Create a new instance of the helper
Add strings to translate
Fetch the translation
Access the translated strings
Retrieving all strings at once:
Retrieving specific strings by ID:
Ignoring parts of strings
To avoid parts of strings being translated, the characters to ignore can be specified as needed. They are replaced by placeholders by a simple search & replace before sending the translation to DeepL, and restored again afterwards.
DeepL API connection
The translator class uses the SC-Networks/deepl-api-connector DeepL API package to connect to the service in the background.
If you need more advanced features, like translating files and the like, you may use the fully configured connector instance directly:
Running the tests
By default, the unit tests will only test the offline API of the Translator itself. To enable live testing with the DeepL API, rename the file tests/apikey.dist.php
to tests/apikey.php
and edit it to insert your API key. The additional tests will be enabled automatically.
All versions of deepl-xml-translator with dependencies
scn/deepl-api-connector Version dev-master
guzzlehttp/guzzle Version ^7.4.2
ext-dom Version *
ext-openssl Version *