Simple implementation of a web translator realised using php + html + deepl-php + DeepL API
- DeepL API subscription (Free tier gives you 500K character of translation) https://www.deepl.com/pro-api?cta=header-pro-api
- deepl-php (Official PHP client library for the DeepL API): https://github.com/DeepLcom/deepl-php
-
In the
index.php
file remember to replace the API$authKey
value with your own key obtained from DeepL web site.<?php session_start(); require __DIR__.'/../vendor/autoload.php'; $authKey = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xx"; // Replace with your key $translator = new \DeepL\Translator($authKey); $usage = $translator->getUsage(); ...
-
You can add languages in the
$langs
values of theindex.php
:$langs = [ [ "name" => "Italian", "value" => "IT", "flag" => "🇮🇹" ], [ "name" => "English", "value" => "EN-GB", "flag" => "🇬🇧" ], ...