Download the PHP package davmixcool/php-sentiment-analyzer without Composer

On this page you can find all versions of the php package davmixcool/php-sentiment-analyzer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
davmixcool/php-sentiment-analyzer
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package php-sentiment-analyzer

PHP Sentiment Analyzer

PHP Sentiment Analyzer is a lexicon and rule-based sentiment analysis tool for PHP using VADER (Valence Aware Dictionary and sEntiment Reasoner), matching the reference Python implementation exactly.

CI Latest Version PHP Version Total Downloads License Stars Forks

Features

Requirements

Using PHP below 8.1? Install the 1.x line instead — it is maintained and produces the same scores: composer require davmixcool/php-sentiment-analyzer:^1.3

Contents

Documentation

Install

Composer

Run the following to include this via Composer

Modern API

Available from 2.0. Returns an immutable result object instead of a bare array.

Labels follow the VADER convention and are exposed as constants, so you can reclassify without hardcoding: compound >= 0.05 is positive, <= -0.05 is negative, and anything between is neutral.

Batch analysis preserves your input keys, so results line up with their source rows:

Custom lexicons return a new analyzer — the original is untouched:

withLexicon() rejects multi-word terms and non-numeric values rather than coercing them. The older updateLexicon() below stays lenient and unchanged.

Simple Usage

Simple Outputs

Advanced Usage

You can now dynamically update the VADER (Valence) lexicon on the fly for words that are not in the dictionary. See the Example below:

Advanced Outputs

Upgrading

3.0.0 changes scores. The scoring engine is now a faithful port of reference Python VADER; roughly 45% of test cases moved. Previous behaviour was wrong most importantly in negation, which was applied at about a third of its intended strength.

Input 2.x 3.0
aint good -0.1423 -0.3412
I have never been so happy -0.2699 +0.6948
good!!!! 0.0000 +0.6209
he is a kind person 0.0000 +0.5267
the shit +0.6124 -0.5574

If you store sentiment scores or compare them against thresholds, re-score affected text after upgrading. A threshold tuned against 2.x will behave differently — usually catching more genuinely negative text than before.

If you need score stability, stay on the maintained 2.x line:

Three lines are maintained: 3.x (matches reference VADER), 2.x (scores frozen), 1.x (PHP below 8.1). Full detail in MIGRATION.md.

Relationship to VADER

This package matches reference Python vaderSentiment 3.3.2 exactly.

The lexicon files are byte-identical to upstream, and the rule engine is a faithful port — including reference VADER's own quirks, so that scores agree rather than merely being close. Conformance is verified, not asserted:

That scores a 350-case corpus with both implementations and fails if a single case differs. It runs in CI on every push.

Before 3.0.0 this was not true — the port diverged from reference on 47% of cases, most importantly by applying negation at roughly a third of its intended strength. See MIGRATION.md if you are upgrading from 1.x or 2.x, because your scores will change.

License

The package's source code is licensed under the MIT license.

The bundled sentiment and emoji lexicons in src/Lexicons/ are third-party data, redistributed from cjhutto/vaderSentiment under its own MIT license (Copyright (c) 2016 C.J. Hutto). Full attribution and license text are in NOTICE.md.

Reference

Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.


All versions of php-sentiment-analyzer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package davmixcool/php-sentiment-analyzer contains the following files

Loading the files please wait ...