PHPackages                             tootootltd/azure-text-analytics - 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. tootootltd/azure-text-analytics

ActiveLibrary

tootootltd/azure-text-analytics
===============================

A Laravel wrapper around Azure's Text Analytics API. Including; Sentiment Analysis, Key Phrase Extraction, Named Entity Recognition, and Language Detection

1.2.0(2y ago)33361MITPHPPHP ^7.4|^8.0

Since Jun 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/tootootltd/azure-text-analytics)[ Packagist](https://packagist.org/packages/tootootltd/azure-text-analytics)[ Docs](https://github.com/tootootltd/azure-text-analytics)[ RSS](/packages/tootootltd-azure-text-analytics/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

PHP Azure Text Analytics
========================

[](#php-azure-text-analytics)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3b73e935997b2c33b8de1aa5b3c2fa6de66aaa04d94684e63f086d5af0a6b909/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6f746f6f746c74642f617a7572652d746578742d616e616c79746963732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tootootltd/azure-text-analytics)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![run-tests](https://github.com/tootootltd/azure-text-analytics/actions/workflows/run-tests.yml/badge.svg)](https://github.com/tootootltd/azure-text-analytics/actions)

A very simple wrapper around version 3.0 of Azure Cognitive Services' Text Analytics API:

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

[](#installation)

You can install the package via composer:

```
composer require tootootltd/azure-text-analytics
```

Publish the config file and put your Azure Cognitive Services endpoint and key in your env file.

```
php artisan vendor:publish --provider="Tootootltd\AzureTextAnalytics\AzureTextAnalyticsServiceProvider"
```

Requirements
------------

[](#requirements)

1. An Azure Cognitive Services endpoint and key.
2. PHP 7.4

Usage
-----

[](#usage)

This package supports all 5 Text Analytics endpoints and each return the full raw response body.

You can pass your text into the constructor in a few different formats:

**String**

```
$myText = 'Example';
```

**String and ID**

```
$myText = [
	'id' => 1,
	'text' => 'Example'
];
```

**Multiple strings and ID's**

```
$myText = [
	[
		'id' => 1,
		'text' => 'Example one'
	],
	[
		'id' => 2,
		'text' => 'Example two'
	],
	[
		'id' => 3,
		'text' => 'Example three'
	]
];
```

Just pass any of these into the constructor.

```
$text = new AzureTextAnalytics($myText)
```

This package will do a bit of validation on your text before hitting Azure's API, such as;

1. Checking the length of each `document` (string of text) and the number of `documents` per request to ensure they aren't above the Azure API's limits (`5,120` characters and `1,000` documents at time of writing respectively). In both these instances an `ExceededApiLimit` exception will be thrown. More info on these limits can be found on [Azure's documentation](https://learn.microsoft.com/en-gb/azure/cognitive-services/language-service/concepts/data-limits#maximum-documents-per-request).
2. Ensuring that the required fields are present when passing an array (`id` and `text` at time of writing). More info on these can be found on [Azure's documentation](https://learn.microsoft.com/en-us/azure/cognitive-services/language-service/).

### Methods:

[](#methods)

**Sentiment Analysis** - View [example response](https://docs.microsoft.com/en-gb/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3#view-the-results)

```
$text = new AzureTextAnalytics($myText)
$text->sentimentAnalsis();
```

**Key Phrases** - View [example response](https://docs.microsoft.com/en-gb/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-keyword-extraction#step-3-view-results)

```
$text = new AzureTextAnalytics($myText)
$text->keyPhrases();
```

**Language Detection** - View [example response](https://docs.microsoft.com/en-gb/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-language-detection#step-3-view-the-results)

```
$text = new AzureTextAnalytics($myText)
$text->detectLanguage();
```

**Named Entity Recognition** - View [example response](https://docs.microsoft.com/en-gb/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking?tabs=version-3#example-ner-response)

```
$text = new AzureTextAnalytics($myText)
$text->namedEntityRecognition();
```

**Entity Linking** - View [example response](https://docs.microsoft.com/en-gb/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking?tabs=version-3#example-entity-linking-response)

```
$text = new AzureTextAnalytics($myText)
$text->entityLinking();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

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 ~224 days

Recently: every ~336 days

Total

7

Last Release

797d ago

PHP version history (2 changes)1.0.0PHP ^7.4

1.1.3PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/24530d75769cbfff705d4dd82f2dd0b27b9b9c557020efb9f9388848cd00f925?d=identicon)[theinnes](/maintainers/theinnes)

---

Top Contributors

[![kieraninnes](https://avatars.githubusercontent.com/u/1272440?v=4)](https://github.com/kieraninnes "kieraninnes (14 commits)")

---

Tags

tootootltdazure-text-analytics

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tootootltd-azure-text-analytics/health.svg)

```
[![Health](https://phpackages.com/badges/tootootltd-azure-text-analytics/health.svg)](https://phpackages.com/packages/tootootltd-azure-text-analytics)
```

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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