PHPackages                             otifsolutions/php-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. otifsolutions/php-sentiment-analysis

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

otifsolutions/php-sentiment-analysis
====================================

Php Sentiment Analysis allows user to analyze sentiments from a text statement

v1.0.2(5y ago)4542MITPHP

Since Jun 2Pushed 3y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Php Sentiment Analysis
----------------------

[](#php-sentiment-analysis)

Install via Composer

### Using Composer (Recommended)

[](#using-composer-recommended)

You can run the following command in the root directory of your project:

```
composer require otifsolutions/php-sentiment-analysis

```

### Usage

[](#usage)

- **Php Sentiment Analysis allows to analyze a text statement if it is positive or negative. e.g. comment on any post.**

    ```
    Sentiment::make()->analyze($value);
    ```

    - Where $value is the statement to be analyzed.
- Statement may contain labels, emojis and negators.

    - Labels are words statement contains e.g. `corruption`, `boycott`.
    - Emoji e.g. `😍`, `💖`.
    - Negators are words that negate something e.g. `doesnt`, `not`.
- **We use following methods**

    - `getTokens`

        - This method separate the words from the given statement and returns all words.
    - `getDataSet`

        - This method has dataset.
        - Labels, emojis and negators already stored in the dataset, which have a positive or negative value.
        - For example `"fun": 4, "funeral": -1,`

This example demonstrates the usage of `Php Sentiment Analysis`,

```
  Sentiment::make()->analyze('She is famous, but she hates others.');
```

```
  {
   "score": -1,
   "comparative": -0.14285714285714285,

   "calculation": [
     {"she": 0},{"is": 0},{"famous": 2},{"but": 0},{"she": 0},{"hates": -3},{"others": 0}
     ],

   "tokens":  [
    "she","is","famous","but","she","hates","others"
      ],

   "positive": [
      "famous"
      ],

   "negative": [
      "hates"
      ]
  }

```

OptionDescription`score`Positive or negative value after analysis of given statement.`tokens`Tokens are the separated words in a Statement.`comparative`Value received when score is divided by count of token.`calculation`Words in an array with a positive or negative value, if the word exists in `dataset` the value will be positive or negative otherwise value will be zero.`positive`Shows all positive words from the statement.`negative`shows all negative words from the statement.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Total

3

Last Release

2172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f9aeabc454ee05b530e6234f1689a89e8f63bc766e647ad78bec54add4215b4?d=identicon)[otifsolutions](/maintainers/otifsolutions)

---

Top Contributors

[![mtayyab7725](https://avatars.githubusercontent.com/u/66251458?v=4)](https://github.com/mtayyab7725 "mtayyab7725 (4 commits)")[![junaidmaqbutt](https://avatars.githubusercontent.com/u/13379343?v=4)](https://github.com/junaidmaqbutt "junaidmaqbutt (1 commits)")

### Embed Badge

![Health badge](/badges/otifsolutions-php-sentiment-analysis/health.svg)

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

###  Alternatives

[lootils/geo

A simple library for dealing with Earth geo coordinate manipulations.

1624.7k1](/packages/lootils-geo)[maxtee/blockchain

This is a package designed to integrate with laravel 5.0+

571.2k](/packages/maxtee-blockchain)[wplake/typed

Lightweight PHP utility for seamless type-casting and data retrieval from dynamic variables, arrays, and objects.

231.0k](/packages/wplake-typed)

PHPackages © 2026

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