PHPackages                             antoineaugusti/laravel-sentiment-analysis - 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. [Framework](/categories/framework)
4. /
5. antoineaugusti/laravel-sentiment-analysis

ActiveLibrary[Framework](/categories/framework)

antoineaugusti/laravel-sentiment-analysis
=========================================

A Laravel wrapper that performs sentiment analysis over an English sentence

v4.1(4y ago)45117.2k↑183.3%16[1 issues](https://github.com/AntoineAugusti/laravel-sentiment-analysis/issues)1Apache-2.0HackPHP &gt;=7.2

Since Jul 23Pushed 4y ago3 watchersCompare

[ Source](https://github.com/AntoineAugusti/laravel-sentiment-analysis)[ Packagist](https://packagist.org/packages/antoineaugusti/laravel-sentiment-analysis)[ RSS](/packages/antoineaugusti-laravel-sentiment-analysis/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (13)Used By (1)

Laravel Sentiment Analysis
==========================

[](#laravel-sentiment-analysis)

[![Build Status](https://camo.githubusercontent.com/598af97cc524c344d7b2dd3d5a126c7bd34f622d2c0760a8ec1baa15bb584ed6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f416e746f696e65417567757374692f6c61726176656c2d73656e74696d656e742d616e616c797369732f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/AntoineAugusti/laravel-sentiment-analysis)[![Software License](https://camo.githubusercontent.com/b15dd5b7856b026d8183ded340ff646738284378f4736893fe785a746e482572/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE.md)[![Latest Version](https://camo.githubusercontent.com/698ab40b1189b6a189bca8348e55b10f391779a0881b980675448dbd5829d466/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f416e746f696e65417567757374692f6c61726176656c2d73656e74696d656e742d616e616c797369732e7376673f7374796c653d666c6174)](https://github.com/AntoineAugusti/laravel-sentiment-analysis/releases)[![Packagist](https://camo.githubusercontent.com/6329757196a9fd6964b5349306e43708f5606b976859f2e98d1488179d008b3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f416e746f696e65417567757374692f6c61726176656c2d73656e74696d656e742d616e616c797369733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6329757196a9fd6964b5349306e43708f5606b976859f2e98d1488179d008b3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f416e746f696e65417567757374692f6c61726176656c2d73656e74696d656e742d616e616c797369733f7374796c653d666c61742d737175617265)

Introduction
------------

[](#introduction)

A Laravel wrapper for [phpInsight](https://github.com/JWHennessey/phpInsight).

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

[](#installation)

[PHP](https://php.net) 7.2+, and [Composer](https://getcomposer.org) are required.

To get the latest version of Laravel Sentiment Analysis, run the command `composer require antoineaugusti/laravel-sentiment-analysis`.

You can register the SentimentAnalysis facade in the `aliases` key of your `config/app.php` file if you like.

```
'SentimentAnalysis' => Antoineaugusti\LaravelSentimentAnalysis\SentimentAnalysis::class,
```

#### Looking for a Laravel 5 compatible version?

[](#looking-for-a-laravel-5-compatible-version)

Checkout the [1.2 version](https://github.com/AntoineAugusti/laravel-sentiment-analysis/releases/tag/v2.2), installable by requiring `"antoineaugusti/laravel-sentiment-analysis": "2.2"`.

#### Looking for a Laravel 4 compatible version?

[](#looking-for-a-laravel-4-compatible-version)

Checkout the [1.2 version](https://github.com/AntoineAugusti/laravel-sentiment-analysis/releases/tag/v1.2), installable by requiring `"antoineaugusti/laravel-sentiment-analysis": "1.2"`.

Usage
-----

[](#usage)

Sentences can be classified as **negative**, **neutral** or **positive**. The only supported language for the moment is **English**.

Custom Dictionary
-----------------

[](#custom-dictionary)

You can provide a custom dictionary by providing the path the folder when you create a new `SentimentAnalysis` object.

`$analysis = new SentimentAnalysis(storage_path('custom_dictionary/'));`

Please look at [the PHPInsight data files](https://github.com/JWHennessey/phpInsight/tree/master/lib/PHPInsight/data) to see how you should name and structure your files.

### SentimentAnalysis::isNegative($sentence)

[](#sentimentanalysisisnegativesentence)

Returns a boolean telling if the given `$sentence` is classified as negative.

### SentimentAnalysis::isNeutral($sentence)

[](#sentimentanalysisisneutralsentence)

Returns a boolean telling if the given `$sentence` is classified as neutral.

### SentimentAnalysis::isPositive($sentence)

[](#sentimentanalysisispositivesentence)

Returns a boolean telling if the given `$sentence` is classified as positive.

### SentimentAnalysis::decision($sentence)

[](#sentimentanalysisdecisionsentence)

Get the sentiment of a sentence. Will return `negative`, `neutral` or `positive`

### SentimentAnalysis::score($sentence)

[](#sentimentanalysisscoresentence)

Get the confidence of a decision for a result. The closer to 1, the better!

### SentimentAnalysis::scores($sentence)

[](#sentimentanalysisscoressentence)

Get the score value for each decision. Returns an array. The closer to 1, the better! Return example:

```
['negative' => 0.5, 'neutral' => 0.25, 'positive' => 0.25]

```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~307 days

Recently: every ~480 days

Total

10

Last Release

1552d ago

Major Versions

v1.1.1 → v2.02015-02-08

v1.2 → v2.12016-11-11

v2.2 → v3.02019-12-16

v3.0 → v4.02020-05-04

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v3.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd9d5a56cb260e00c6d1963f9ba430b351227b65fe02ab535960d3b70ff35075?d=identicon)[AntoineAugusti](/maintainers/AntoineAugusti)

---

Top Contributors

[![AntoineAugusti](https://avatars.githubusercontent.com/u/295709?v=4)](https://github.com/AntoineAugusti "AntoineAugusti (20 commits)")[![ibarrajo](https://avatars.githubusercontent.com/u/1480657?v=4)](https://github.com/ibarrajo "ibarrajo (2 commits)")[![Sekonda](https://avatars.githubusercontent.com/u/127744940?v=4)](https://github.com/Sekonda "Sekonda (1 commits)")[![simondotwhite](https://avatars.githubusercontent.com/u/793770?v=4)](https://github.com/simondotwhite "simondotwhite (1 commits)")[![stephenahiggins](https://avatars.githubusercontent.com/u/12612312?v=4)](https://github.com/stephenahiggins "stephenahiggins (1 commits)")

---

Tags

composercomposer-packagelaravellaravel-wrapperphpsentimentanalysisframeworklaravelanalysissentimentsentiment analysisAugustiAntoine AugustiAntoineAugusti

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antoineaugusti-laravel-sentiment-analysis/health.svg)

```
[![Health](https://phpackages.com/badges/antoineaugusti-laravel-sentiment-analysis/health.svg)](https://phpackages.com/packages/antoineaugusti-laravel-sentiment-analysis)
```

###  Alternatives

[rebing/graphql-laravel

Laravel wrapper for PHP GraphQL

2.2k7.1M26](/packages/rebing-graphql-laravel)[graham-campbell/markdown

Markdown Is A CommonMark Wrapper For Laravel

1.3k7.1M64](/packages/graham-campbell-markdown)[graham-campbell/manager

Manager Provides Some Manager Functionality For Laravel

39221.1M134](/packages/graham-campbell-manager)[laravel-lang/publisher

Localization publisher for your Laravel application

2167.7M24](/packages/laravel-lang-publisher)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[lanin/laravel-api-debugger

Easily debug your JSON API.

2311.8M](/packages/lanin-laravel-api-debugger)

PHPackages © 2026

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