PHP code example of pervozdanniy / translation-client

1. Go to this page and download the library: Download pervozdanniy/translation-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pervozdanniy / translation-client example snippets




$options = [
    'login' => '<YOUR_LOGIN>',
    'password' => '<YOUR_PASSWORD>',
];
// you can pass any storage you want that implements \Psr\SimpleCache\CacheInterface
$client = new \Translate\ApiClient($options, new \Translate\Storage\ArrayStorage);
$response = $client->request('GET', 'users');

echo $response->getStatusCode(); # 200
echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8'
echo $response->getBody(); # '{"items": [{"uuid": ...}'

$response = $client->request('GET', 'users/{userUuid}/projects');

$client->setAlias('projectUuid', '<PROJECT_UUID>');
// use user-defined alias
$response = $client->request('GET', 'projects/{projectUuid}/languages');
bash
# Install Composer
curl -sS https://getcomposer.org/installer | php