jord-jd / php-summary
PHP Summarization Library
Fund package maintenance!
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: ^7.5 || ^9.6
Replaces
- divineomega/php-summary: v5.0.1
This package is auto-updated.
Last update: 2026-07-18 03:01:14 UTC
README
A PHP library to automatically summarise text using a naive summarisation algorithm.
This summarisation algorithm takes the key sentence from each paragraph. It then strings these resulting sentences together to form the summary. Single-sentence paragraphs and final sentences without punctuation are supported.
For more details on this algorithm, see this blog post by Shlomi Babluki.
Installation
Require this package, with Composer, in the root directory of your project.
composer require jord-jd/php-summary
Usage
To use PHP Summary, you should create a new SummaryTool object, passing it the text content of your article. You can then call its getSummary method to retrieve the shortened summary of the article.
Paragraphs may be separated by blank Unix, Windows, or classic Mac lines.
use JordJD\PHPSummary\SummaryTool; $summary = (new SummaryTool($content))->getSummary();