Download the PHP package fei/translate-client without Composer

On this page you can find all versions of the php package fei/translate-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 translate-client

Service Translate - Client

Table of contents

Purpose

This client permit to use the Translate Api. Thanks to it, you could request the API to :

easily

Requirements

Runtime

Step by step Installation

for all purposes (devlopment, contribution and production)

Initialization

Configuration

The Translate client needs some options to work properly. The available options that can be passed to the __construct() or setOptions() methods are :

Option Description Type Possible Values Default
OPTION_BASEURL This is the server to which send the requests. string Any URL, including protocol but excluding path --
OPTION_HEADER_AUTHORIZATION Api Key for authentification string Any string value ''

Settings

Don't forget to set the right baseUrl :

Beanstalkd configuration

Running Beanstalkd is very simple. However, you must pay attention to the z option which set the maximum job (or message) size in bytes. So, if you want send multiple translations to Translate API, you should allow enough bytes according to the length of your translations.

Launch Unit test

Start the docker with docker-compose up -d

Then docker exec -ti translateclient_php_1 /var/html/vendor/bin/codecept run unit

Run api-client-worker.php

You could see below an example of running api-client-worker.php:

php /path/to/translate-client/vendor/bin/api-client-worker.php --host 127.0.0.1 --port 11300 --delay 3

Options Shortcut Description Default
host -h The host of Beanstalkd instance localhost
port -p The port which Beanstalkd instance listening 11300
delay -d The delay between two treatment of the worker 3 seconds
verbose -v Print verbose information -

You can control the api-client-worker.php process by using Supervisor.

Configuration

In order to make the client working properly, you need to configure a couple of paramaters :.

The configuration takes place in the config/config.php file. Here is a complete example of the configurations :

Known issues

No known issue at this time.

Contribution

As FEI Service, designed and made by OpCoding. The contribution workflow will involve both technical teams. Feel free to contribute, to improve features and apply patches, but keep in mind to carefully deal with pull request. Merging must be the product of complete discussions between Flash and OpCoding teams :)

Link to documentation

Examples

You can test this client easily thanks to the folder examples

Here, an example on how to use example : php /my/translate-client/folder/examples/translate.php

Basic usage

In order to consume Translate methods, you have to define a new Translate instance and set the right transport (Asynchronously or Synchronously).

Translate client instance will first attempt to transfer the messages with Beanstalkd, if the process fail then the client will try to send I18nString payload directly to the right API endpoint.

There are several methods in Translate class, all listed in the following table:

Method Parameters Return
fetchOne int $id I18nString
fetchAll
find string $key, string $lang = '', string $domain = '' ArrayCollection or I18nString
search Pattern $pattern array
store I18nString $string or array $string array
update I18nString $string or array $string array
delete int or I18nString or Pattern or string $parameter bool
subscribe string $server = null, array $namespaces, $encoding = 'UTF-8' bool
unsubscribe string $server = null, array $namespaces bool
handleRequest string $requestUri = null, string $requestMethod = null Translate
setClient Translate $client Translate
setLang string $lang Translate
setDomain string $domain Translate
setLogger Logger $logger Translate

All versions of translate-client with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
fei/api-client Version ^1.1
fei/logger-client Version ^1.2
doctrine/common Version ^2.6.1
fei/translate-common Version ^1.0.0
nikic/fast-route Version ^1.2
zendframework/zend-diactoros Version ^1.3
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 fei/translate-client contains the following files

Loading the files please wait ....