baby-markt / deepl-php-lib Goto Github PK
View Code? Open in Web Editor NEW๐ง DeepL API Client Library supporting PHP >= 7.3
Home Page: https://www.deepl.com/api.html
License: MIT License
๐ง DeepL API Client Library supporting PHP >= 7.3
Home Page: https://www.deepl.com/api.html
License: MIT License
Since the last update I got an fatal error:
PHP Fatal error: Uncaught InvalidArgumentException: $tagHandling must be of type String in V2 of DeepLLibrary in /var/www/vhosts/ictergezocht.nl/httpdocs/vendor/babymarkt/deepl-php-lib/src/DeepL.php:136
test
I'm using the free version of deepl and I setup everything as per the instructions, but I'm getting the following error:
The Response seems to not be valid JSON. {"userId":2,"exception":"[object] (BabyMarkt\\DeepL\\DeepLException(code: 403)
When using CURL directly with the same API key, it works correctly.
I've tried the below and didn't work:
Then I do deepl->translate($text, \App::getLocale(), $lang)
and get the 403
Would you know what could be happning?
I was getting an authentication error: "Authorization failed. Please supply a valid auth_key parameter." and was waiting for it to become "activated", lol.
Since v2 is now the default API version, it must be specified:
$deepl = new DeepL($authKey, 2);
Error, two translations in each interaction of a foreach.
(Laravel Framework, PHP 8)
my function, for the translation:
public function translation($text)
{
$deepl = new DeepL($this->authKey,2,'api.deepl.com');
$translate = $deepl->translate($text, 'en', 'fr');
return $translate[0]['text'];
}
I am running into the following error:
Fatal error: Uncaught Error: Class "DeepL" not found in
I use the following code:
require_once("../deepl-api/vendor/autoload.php"); // the path is correct, I tested that first
$deepl = new DeepL('KEY',2,'api.deepl.com'); // KEY IS REPLACED WITH THE RIGHT KEY
return $deepl->translate('Hello World, 'en, 'fr');
Any ideas? Looks like other people does not have this problem?
Thanks a lot!
Please tag the current master as v1.0.11 so that people can use it with composer without using dev-master release.
Hi, I just found a bug when trying to create a custom "update" operation for my glossaries. Since the API does not support an update operation what I did as a workaround was to delete first the Glossary and then recreate it with the new entries list.
The problem is that this library has a bug when you make a POST request after a DELETE request, I get the error The Response seems to not be valid JSON.
The BabyMarkt\DeepL\Client
needs a way to reset its $curl
property after any of those requests. I added these lines just before handling the response and it suddenly worked
if ($this->curl && is_resource($this->curl)) {
curl_close($this->curl);
}
$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
I've tried adding the below on the top of my trait, but it didn't work:
use Babymarkt\DeeplPhpLib\DeepL;
But it says class not found - Sorry for the noob question :(
I'm getting the following when running composer update:
babymarkt/deepl-php-lib[v3.0.0, ..., v3.1.0] require php >=7.3 <8.1 -> your php version (8.1.2) does not satisfy that requirement.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.