Giter Site home page Giter Site logo

baby-markt / deepl-php-lib Goto Github PK

View Code? Open in Web Editor NEW
50.0 9.0 27.0 726 KB

๐Ÿง  DeepL API Client Library supporting PHP >= 7.3

Home Page: https://www.deepl.com/api.html

License: MIT License

PHP 100.00%
deepl deepl-api i18n api php php-library php-client deepl-client language translation

deepl-php-lib's People

Contributors

arkadiusjonczek avatar bestog avatar denex23 avatar etiennedh avatar floranpagliai avatar githubwnk avatar janbarasek avatar martonfarago avatar mgoniwiecha avatar nicolus avatar shamimmoeen avatar ssumpfatbabymarkt avatar tomschwiha avatar vims avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deepl-php-lib's Issues

Missed some languages

Missed some supported languages such as "ZH", "JA", "PL". Actually these are supported by DeepL and could you update asap ?

I checked your source code and its easy i think ;)
image

Getting 403 although the API key is correct

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:

  • $deepl = new DeepL('KEY');
  • $deepl = new DeepL('KEY','api-free.deepl.com');
  • $deepl = new DeepL('KEY','api-free.deepl.com/v2/translate');

Then I do deepl->translate($text, \App::getLocale(), $lang) and get the 403

Would you know what could be happning?

The API version must be specified

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);

The Response seems to not be valid JSON

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'];
    }

Fatal error: Uncaught Error: Class "DeepL" not found in

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!

Release v1.0.11

Please tag the current master as v1.0.11 so that people can use it with composer without using dev-master release.

[Bug] Cannot create a Glossary after deleting another one

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);

Compatibility with PHP >8.1

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.