Download the PHP package neverendless/translator-client without Composer

On this page you can find all versions of the php package neverendless/translator-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package translator-client

Neverendless Translator — PHP Client

PHP client library for the Neverendless Translator REST API. Translate text via a self-hosted AI translation service with Redis caching.

Zero dependencies — uses PHP's built-in curl extension only.

Requires: PHP 8.1+ · ext-curl


Installation


Quick Start


Usage

Translate a string

Cache policies

Select the policy based on the message type — never forward a player-supplied value:

Constant Wire Redis read Redis write Use case
CachePolicy::NORMAL normal Yes Yes (AI only) Public chat
CachePolicy::NO_STORE no_store Yes Never Private messages
CachePolicy::BYPASS bypass No Never Sensitive content

Language codes

The service accepts both normalized ISO-639-1 codes and full English names for backward compatibility:

The response always returns normalized codes in sourceLang and targetLang.

Health check


TranslationResult

Property Type Description
translation string Translated text (original on fallback)
sourceLang string Detected source language — normalized code ('fr'), 'unknown', or 'mixed'
targetLang string Target language — normalized code ('en')
original string Original input text
engine string 'cache' · 'ai' · 'none'
status string 'success' · 'fallback'
requestId ?string Correlation ID echoed from the request
resultCode int Stable numeric result code (see below)
safeError string Bounded error description when resultCode > 0

Result codes:

Code Name Meaning
0 SUCCESS A real cache or AI translation was produced
1 FALLBACK Original text returned; do not persist as translated
2 INVALID_LANGUAGE Unsupported target language
3 INVALID_REQUEST Malformed request
4 TEXT_TOO_LARGE Input exceeds the service size limit
5 BUSY Queue full — retry shortly
6 MODEL_TIMEOUT Ollama timed out
7 SERVICE_UNAVAILABLE Inference service unreachable
8 INTERNAL_ERROR Unexpected failure

Helper methods: isSuccess() · isCacheHit() · isFallback() · isInvalidLanguage() · isBusy()


Timeout

Default is 150 seconds — must exceed the service's OLLAMA_TIMEOUT (default 120s) plus network headroom. Cache hits return in ~2–50ms regardless of timeout. For rendering-critical paths that cannot wait for AI inference, catch TranslatorException and display the original text:


Service Setup

This package is a client only. The translation service is a self-hosted Python microservice: github.com/Neverendless-WoW/TranslatorService

Tokens are configured in the service's environment. Never place tokens in browser JavaScript.


Releases

See GitHub releases page.

Versioning follows Semantic Versioning.


All versions of translator-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package neverendless/translator-client contains the following files

Loading the files please wait ...