PHPackages                             php-science/textrank - 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. [Search &amp; Filtering](/categories/search)
4. /
5. php-science/textrank

ActiveLibrary[Search &amp; Filtering](/categories/search)

php-science/textrank
====================

TextRank (automatic text summarization) for PHP.

1.2.3(2y ago)2461.7M—9.8%42[1 PRs](https://github.com/DavidBelicza/PHP-Science-TextRank/pulls)2MITPHPPHP &gt;=7.2

Since Aug 6Pushed 2y ago11 watchersCompare

[ Source](https://github.com/DavidBelicza/PHP-Science-TextRank)[ Packagist](https://packagist.org/packages/php-science/textrank)[ RSS](/packages/php-science-textrank/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (14)Used By (2)

TextRank
=========

[](#textrank)

 [ ![](https://github.com/php-science/textrank/workflows/tests/badge.svg) ](https://github.com/PHP-Science/TextRank/actions) [ ![](https://camo.githubusercontent.com/8ee2e01f268a94c06657db4c441719e745953e2425ca6f1bacd5752cbc6e2072/68747470733a2f2f706f7365722e707567782e6f72672f7068702d736369656e63652f7465787472616e6b2f762f737461626c652e737667) ](https://packagist.org/packages/php-science/textrank) [ ![](https://camo.githubusercontent.com/9e4023283a58781ab3b32a94676fea59e69c19cf690c9b4ee69ca8ef97ae8967/68747470733a2f2f706f7365722e707567782e6f72672f7068702d736369656e63652f7465787472616e6b2f646f776e6c6f616473) ](https://packagist.org/packages/php-science/textrank) [ ![](https://camo.githubusercontent.com/d0bb7d3f26feaf2cd69cc4a0b565d3310c8d3420272b9ae8f28b308fd731e445/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d4646463330302e737667) ](https://github.com/PHP-Science/TextRank/blob/master/LICENSE)

This source code is an implementation of TextRank algorithm in PHP programming language, under MIT licence.

TextRank vs. ChatGPT
====================

[](#textrank-vs-chatgpt)

GPTs like ChatGPT are supervised language models that understand the context and generate new content from the given input using vast resources while TextRank is a cost-efficient/low-cost text extraction algorithm. TextRank algorithm also can be used as a pre-processor to a GPT model to reduce the text size to save on resource consumption.

TextRank or Automatic summarization
===================================

[](#textrank-or-automatic-summarization)

> Automatic summarization is the process of reducing a text document with a computer program in order to create a summary that retains the most important points of the original document. Technologies that can make a coherent summary take into account variables such as length, writing style and syntax. Automatic data summarization is part of machine learning and data mining. The main idea of summarization is to find a representative subset of the data, which contains the information of the entire set. Summarization technologies are used in a large number of sectors in industry today. - Wikipedia

The algorithm of this implementation is:

- Extracts sentences,
- Removes stopwords,
- Adds integer values to words by finding and counting the matching words,
- Weights the values of the words,
- Normalizes values to get the scores,
- Sorts by scores

Install to use it in your project
=================================

[](#install-to-use-it-in-your-project)

```
cd your-project-folder
composer require php-science/textrank

```

Install for contributing
========================

[](#install-for-contributing)

```
cd git-project-folder
docker-compose build
docker-compose up -d
composer install
composer test

```

Examples
========

[](#examples)

```
use PhpScience\TextRank\Tool\StopWords\English;

// String contains a long text, see the /res/sample1.txt file.
$text = "Lorem ipsum...";

$api = new TextRankFacade();
// English implementation for stopwords/junk words:
$stopWords = new English();
$api->setStopWords($stopWords);

// Array of the most important keywords:
$result = $api->getOnlyKeyWords($text);

// Array of the sentences from the most important part of the text:
$result = $api->getHighlights($text);

// Array of the most important sentences from the text:
$result = $api->summarizeTextBasic($text);
```

More examples:

- [tests/TextRankFacadeTest.php](https://github.com/DavidBelicza/PHP-Science-TextRank/blob/master/tests/TextRankFacadeTest.php)
-

Authors, Contributors
=====================

[](#authors-contributors)

NameGitHub userDavid Belicza@DavidBeliczaRiccardo Marton@riccardomartonSyndesi@Syndesivincentsch@vincentschAndrew Welch@khalwatAndrey Astashov@mvcaaaLeo Toneff@bragleWilly Arisky@willyariskyRobert-Jan Keizer@KeizerDevMorty@evil1mortySezer Fidancı@SezerFidanci

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity59

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 78.6% 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 ~225 days

Recently: every ~281 days

Total

13

Last Release

871d ago

Major Versions

1.1.1 → 2.0.0.x-dev2020-09-26

PHP version history (3 changes)1.0.0PHP 7.\*

2.0.0.x-devPHP 7.4.\*

1.2.0.x-devPHP &gt;=7.2

### Community

Maintainers

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

---

Top Contributors

[![DavidBelicza](https://avatars.githubusercontent.com/u/5840286?v=4)](https://github.com/DavidBelicza "DavidBelicza (55 commits)")[![doveid](https://avatars.githubusercontent.com/u/195571873?v=4)](https://github.com/doveid "doveid (7 commits)")[![Syndesi](https://avatars.githubusercontent.com/u/9903723?v=4)](https://github.com/Syndesi "Syndesi (3 commits)")[![mvcaaa](https://avatars.githubusercontent.com/u/1244503?v=4)](https://github.com/mvcaaa "mvcaaa (1 commits)")[![bragle](https://avatars.githubusercontent.com/u/43667677?v=4)](https://github.com/bragle "bragle (1 commits)")[![willyarisky](https://avatars.githubusercontent.com/u/1753963?v=4)](https://github.com/willyarisky "willyarisky (1 commits)")[![evil1morty](https://avatars.githubusercontent.com/u/42971559?v=4)](https://github.com/evil1morty "evil1morty (1 commits)")[![KeizerDev](https://avatars.githubusercontent.com/u/4026917?v=4)](https://github.com/KeizerDev "KeizerDev (1 commits)")

---

Tags

aiairtificialintelligencealgorithmphpsciencesearchsummarizationtextrankphpaiautomaticstrictphp8summarizationscienceartificialintelligencetextrank

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-science-textrank/health.svg)

```
[![Health](https://phpackages.com/badges/php-science-textrank/health.svg)](https://phpackages.com/packages/php-science-textrank)
```

###  Alternatives

[sabatinomasala/replicate-php

PHP client for the Replicate API

3743.6k](/packages/sabatinomasala-replicate-php)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[apicart/fql

Filter Query Language

1110.6k](/packages/apicart-fql)

PHPackages © 2026

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