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

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

croacworks/textrank
===================

TextRank (automatic text summarization) for PHP.

03PHP

Since Oct 30Pushed 6mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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 CroacWorks\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

18

—

LowBetter than 8% of packages

Maintenance46

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/70cec246c76a93a7537ef79fb1b799c0105824ab81396150aa639729bcbcc572?d=identicon)[honaldcs](/maintainers/honaldcs)

---

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)")

### Embed Badge

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

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

PHPackages © 2026

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