PHP Class for LibreTranslate - v1.1.1

PHP class interface to the LibreTranslate API.

  • Set host and port of libretranslate server to use (default localhost:5000)
  • View server settings and supported languages
  • Set API key
  • Detect, Translate
  • TranslateFile (if server supports it)
  • Suggest (if server supports it)
  • LTManage functions for List, Add and Remove API Keys (if using with local server)
3 Likes

Oh, that’s awesome! Thanks for sharing. :pray:

Would you be interested to add this to the list of bindings at https://github.com/LibreTranslate/LibreTranslate#language-bindings ?

1 Like

Of course! That’s why I was trying to make it a package with full functionality. Was trying to find through Github how to get in touch to share it when I found this forum :slight_smile:

One of my clients is a 3rd party shipping company and we have Danish, Swedish, Norwegian and recently U.S. sites and was looking for an easy way to translate a lot of page content. Google wasn’t cutting it as to amount of text and pricing, so went looking for any other way to not have to do it manually and ran across LibreTranslate.

So I set up a basic class for my personal use, but had noticed there wasn’t a PHP in that bindings list. So thought I could extend the functionality and create a package to share back.

(will have to look more into the creating translations - Swedish and Finnish area available, but not Danish or Norwegian - so it only worked out for two of the sites :slight_smile: )

1 Like

Great work, thanks for building this!

I added a link to the GitHub to the LibreTranslate Readme.

2 Likes

v1.1.1 Updates

  • translate() now accepts array of texts for batch translation
  • suggestion() functionality added
  • fix for setting default target language on creation new LibreTranslate()
3 Likes