PHPackages                             badams/microsoft-translator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. badams/microsoft-translator

AbandonedArchivedLibrary[API Development](/categories/api)

badams/microsoft-translator
===========================

PHP implementation of Microsoft's Translator API

1.0.1(10y ago)225MITPHP

Since Feb 11Pushed 9y agoCompare

[ Source](https://github.com/badams/microsoft-translator)[ Packagist](https://packagist.org/packages/badams/microsoft-translator)[ Docs](https://github.com/badams/microsoft-translator)[ RSS](/packages/badams-microsoft-translator/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/089b036746a106ddd365f1fc5e2314b40c8d97861bdac902574ee1bea144aea4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f626164616d732f6d6963726f736f66742d7472616e736c61746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/badams/microsoft-translator)[![Coverage Status](https://camo.githubusercontent.com/70899837887fc19bac6f9506d6f56a5b86cadbfad045ffffc3ab924b6246493d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f626164616d732f6d6963726f736f66742d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/badams/microsoft-translator/code-structure)[![Quality Score](https://camo.githubusercontent.com/2bb95b50c7121ff9d6a5334d525880202687060d5a2c1ddf96249426538cb03e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f626164616d732f6d6963726f736f66742d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/badams/microsoft-translator)

MicrosoftTranslator
===================

[](#microsofttranslator)

#### An easy to use PHP implementation of [Microsoft's Translator API](https://msdn.microsoft.com/en-us/library/ff512419.aspx)

[](#an-easy-to-use-php-implementation-of-microsofts-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.

Currently supported methods
---------------------------

[](#currently-supported-methods)

- [Translate](docs/translate.md): Converts a string of text from one language to another.
- [Detect](docs/detect.md): Detects the language of a selection of text.
- [Speak](docs/speak.md): 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
-------

[](#roadmap)

API methods that are yet to be implemented.

- [TranslateArray](https://msdn.microsoft.com/en-us/library/ff512422.aspx)
- [DetectArray](https://msdn.microsoft.com/en-us/library/ff512412.aspx)
- [TransformText](https://msdn.microsoft.com/en-us/library/dn876735.aspx)
- [AddTranslation](https://msdn.microsoft.com/en-us/library/ff512408.aspx)
- [AddTranslationArray](https://msdn.microsoft.com/en-us/library/ff512409.aspx)
- [BreakSentences](https://msdn.microsoft.com/en-us/library/ff512410.aspx)

Installation
------------

[](#installation)

Install `badams/microsoft-translator` using Composer.

```
$ composer require badams/microsoft-translator
```

Basic Usage
-----------

[](#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
-------

[](#testing)

`MicrosoftTranslator` has a [PHPUnit](https://phpunit.de) test suite. To run the tests, run the following command from the project folder.

```
$ composer test
```

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Total

2

Last Release

3781d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fe4edc8748b6ac4922ab8d16f64de61ad0b552027d8c1630646f6a0d6f09b9d?d=identicon)[badams](/maintainers/badams)

---

Top Contributors

[![badams](https://avatars.githubusercontent.com/u/340715?v=4)](https://github.com/badams "badams (65 commits)")

---

Tags

apimicrosofttranslator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/badams-microsoft-translator/health.svg)

```
[![Health](https://phpackages.com/badges/badams-microsoft-translator/health.svg)](https://phpackages.com/packages/badams-microsoft-translator)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k371.6k6](/packages/theodo-group-llphant)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.5M10](/packages/checkout-checkout-sdk-php)[clicksend/clicksend-php

301.6M11](/packages/clicksend-clicksend-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
