2017 © Pedro Peláez
 

library unbabel-php

Unbabel PHP SDK

image

unbabel/unbabel-php

Unbabel PHP SDK

  • Friday, June 8, 2018
  • by hershaw
  • Repository
  • 37 Watchers
  • 2 Stars
  • 21,440 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 6 Versions
  • 3 % Grown

The README.md

Unbabel's PHP SDK

Project Status: Abandoned – Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development., (*1)

Unbabel's PHP SDK is a wrapper around the Unbabel HTTP API., (*2)

Requirements

  • PHP: 7.x

Installation

The recommended way to install is through Composer:, (*3)

$ composer require unbabel/unbabel-php

Usage

<?php

require 'vendor/autoload.php';

use Unbabel\Unbabel;
use GuzzleHttp\Client;

$httpClient = new Client();
$unbabel = new Unbabel(
    'username', 
    'apiKey',
     false, // Use sandbox server?
     $httpClient
);

$opts = array('callback_url' => 'http://example.com/unbabel_callback.php');
$resp = $unbabel->submitTranslation('This is a test', 'pt', $opts);
if ($resp->getStatusCode() === 201) {
    // Hooray! Now we need to get the uid so when we are called back we know which translation it corresponds to.
    var_dump(json_decode($resp->getBody()->getContents(), true)['uid']);
} else {
    // If you think everything should be working correctly and you still get an error,
    // send email to tech-support@unbabel.com to complain.
    var_dump($resp->getBody());

    exit;
}

// Other examples:
var_dump($unbabel->getTopics()->getBody());
var_dump($unbabel->getJobsWithStatus('new')->getBody());
var_dump($unbabel->getTranslation('8a82e622dbBS')->getBody());
var_dump($unbabel->getTones()->getBody());
var_dump($unbabel->getLanguagePairs()->getBody());

$bulk = [
    ['text' => 'This is a test', 'target_language' => 'pt'],
    ['text' => 'This is a test', 'target_language' => 'es']
];
var_dump($unbabel->submitBulkTranslation($bulk)->getBody());

Contributing

Read about, (*4)

The Versions

08/06 2018

dev-master

9999999-dev

Unbabel PHP SDK

  Sources   Download

LGPL LGPL-3.0-or-later

The Requires

 

The Development Requires

by Unbabel Tech Team

08/06 2018

v1.0

1.0.0.0

Unbabel PHP SDK

  Sources   Download

LGPL-3.0-or-later

The Requires

 

The Development Requires

by Unbabel Tech Team

28/11 2017

v0.4

0.4.0.0

Unbabel PHP SDK

  Sources   Download

LGPL

The Requires

 

The Development Requires

07/12 2015

v0.3

0.3.0.0

Unbabel PHP SDK

  Sources   Download

LGPL

The Requires

 

The Development Requires

20/03 2015

v0.2

0.2.0.0

Unbabel PHP SDK

  Sources   Download

LGPL

The Requires

 

The Development Requires

23/06 2014

v0.1

0.1.0.0

Unbabel PHP SDK

  Sources   Download

LGPL

The Requires

 

The Development Requires