2017 © Pedro Peláez
 

library microsoft-translator-service-provider

Silex service provider for using the Microsoft Translator V2 API

image

post2go/microsoft-translator-service-provider

Silex service provider for using the Microsoft Translator V2 API

  • Wednesday, September 24, 2014
  • by vitaliy-urazov
  • Repository
  • 4 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

MicrosoftTranslatorServiceProvider

By Matthias Noback, (*1)

Installation

Using Composer, add to composer.json:, (*2)

{
    "require": {
        "post2go/microsoft-translator-service-provider": "dev-master"
    }
}

Then using the Composer binary:, (*3)

php composer.phar install

Register the service provider:, (*4)

<?php

use MatthiasNoback\Silex\Provider\MicrosoftTranslatorServiceProvider;

$app->register(new MicrosoftTranslatorServiceProvider(), array(
    'microsoft_oauth.client_id' => 'YOUR-CLIENT-ID',
    'microsoft_oauth.client_secret' => 'YOUR-CLIENT-SECRET',
);

Usage

This service provider wraps the corresponding Microsoft Translator V2 API PHP library and adds the translator as the service microsoft_translator to your application., (*5)

You need to register your application at the Azure DataMarket and thereby retrieve a "client id" and a "client secret". Copy these values to the right keys in the options array (see above):, (*6)

Making calls

Translate a string

// in your controller

$translatedString = $app['microsoft_translator']->translate('This is a test', 'nl', 'en');

// $translatedString will be 'Dit is een test', which is Dutch for...

Detect the language of a string

$text = 'This is a test';

$detectedLanguage = $app['microsoft_translator']->detect($text);

// $detectedLanguage will be 'en'

Get a spoken version of a string

$text = 'My name is Matthias';

$spoken = $app['microsoft_translator']->speak($text, 'en', 'audio/mp3', 'MaxQuality');

// $spoken will be the raw MP3 data, which you can save for instance as a file

For more examples, see the README of the PHP library, (*7)

The Versions

24/09 2014

dev-master

9999999-dev http://github.com/post2go/MicrosoftTranslatorServiceProvider

Silex service provider for using the Microsoft Translator V2 API

  Sources   Download

MIT

The Requires

 

translate bing microsoft translator

24/09 2014

v0.5.1

0.5.1.0 http://github.com/post2go/MicrosoftTranslatorServiceProvider

Silex service provider for using the Microsoft Translator V2 API

  Sources   Download

MIT

The Requires

 

translate bing microsoft translator

28/07 2014

v0.5.0

0.5.0.0 http://github.com/parcelgo/MicrosoftTranslatorServiceProvider

Silex service provider for using the Microsoft Translator V2 API

  Sources   Download

MIT

The Requires

 

translate bing microsoft translator

16/07 2013

v0.2.0

0.2.0.0 http://github.com/matthiasnoback/MicrosoftTranslatorServiceProvider

Silex service provider for using the Microsoft Translator V2 API

  Sources   Download

MIT

The Requires

 

translate bing microsoft translator

16/07 2013

v0.1.0

0.1.0.0 http://github.com/matthiasnoback/MicrosoftTranslatorServiceProvider

Silex service provider for using the Microsoft Translator V2 API

  Sources   Download

MIT

The Requires

 

translate bing microsoft translator