2017 © Pedro Peláez
 

library microsoft-translator

PHP implementation of Microsoft's Translator API

image

badams/microsoft-translator

PHP implementation of Microsoft's Translator API

  • Wednesday, July 27, 2016
  • by badams
  • Repository
  • 0 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Software License Build Status Coverage Status Quality Score, (*1)

MicrosoftTranslator

An easy to use PHP implementation of Microsoft's Translator API

The goal of this project is to provide a modern, elegant, and feature complete implementation of the Microsoft Translation HTTP API to PHP developers., (*2)

Currently supported methods

  • Translate: Converts a string of text from one language to another.
  • Detect: Detects the language of a selection of text.
  • Speak: Generates a wave form of synthesised speech from the given text/language combination.
  • GetLanguagesForSpeak: Obtains a list of the language codes supported by the Translator Service for speech synthesis.
  • GetLanguageNames: Retrieves localized names for the languages passed to it.
  • GetLanguagesForTranslate: Obtains a list of the language codes supported by the Translator Service.
  • GetTranslations: Returns an array of alternative translations of the given text.
  • GetTranslationsArray: Returns an array of alternative translations of the passed array of text.

Roadmap

API methods that are yet to be implemented., (*3)

Installation

Install badams/microsoft-translator using Composer., (*4)

$ composer require badams/microsoft-translator

Basic Usage


use badams\MicrosoftTranslator\MicrosoftTranslator; $clientId = 'YOUR_CLIENT_ID'; $clientSecret = 'YOUR_CLIENT_SECRET'; $translator = new MicrosoftTranslator(); $translator->setClient($clientId, $clientSecret); // Translate a string of text from one language to another $output = $translator->translate('Hello World!', $to = 'fr', $from = 'en'); echo $output; // Salut tout le monde! // Detect the language of a string $language = $translator->detect('Salut tout le monde!'); echo $language; // fr echo $language->getEnglishName(); // French //Returns a wave or mp3 stream of the passed-in text being spoken in the desired language. $data = $translator->speak('Salut tout le monde!', 'fr'); header('Content-Type: audio/mp3'); echo base64_decode($data);

Testing

MicrosoftTranslator has a PHPUnit test suite. To run the tests, run the following command from the project folder., (*5)

bash $ composer test, (*6)

License

MicrosoftTranslator is open-sourced software licensed under the MIT License (MIT). Please see LICENSE for more information., (*7)

The Versions

27/07 2016

dev-master

9999999-dev https://github.com/badams/microsoft-translator

PHP implementation of Microsoft's Translator API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Byron Adams

api translator microsoft

21/02 2016

1.0.1

1.0.1.0 https://github.com/badams/microsoft-translator

PHP implementation of Microsoft's Translator API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Byron Adams

api translator microsoft

11/02 2016

1.0.0

1.0.0.0 https://github.com/badams/microsoft-translator

PHP implementation of Microsoft's Translator API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Byron Adams

api translator microsoft