PHPackages                             moayadmgh/text-perfection - 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. moayadmgh/text-perfection

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

moayadmgh/text-perfection
=========================

TextPerfection is a powerful content rewriting and enhancement plugin that helps you achieve text perfection. With advanced algorithms and linguistic analysis, TextPerfection offers intelligent suggestions and optimizations to transform your written content into a refined and professional masterpiece. Elevate the quality of your text, enhance readability, and ensure impeccable grammar and structure with TextPerfection. Whether you're a writer, blogger, or content creator, TextPerfection empowers you to produce compelling and flawless text that captivates your audience and leaves a lasting impression. Experience the art of text perfection with this essential tool for every wordsmith and communicator

v1.0.0(3y ago)14MITPHPPHP &gt;=8.1

Since May 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/moayadmgh/text-perfection)[ Packagist](https://packagist.org/packages/moayadmgh/text-perfection)[ RSS](/packages/moayadmgh-text-perfection/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (2)Used By (0)

TextPerfection Plugin
=====================

[](#textperfection-plugin)

TextPerfection is a powerful content rewriting and enhancement plugin for **PHP** that helps you achieve text perfection.

With advanced algorithms and linguistic analysis, TextPerfection offers intelligent suggestions and optimizations to transform your written content into a refined and professional masterpiece.

Elevate the quality of your text, enhance readability, and ensure impeccable grammar and structure with TextPerfection.

Whether you're a writer, blogger, or content creator, TextPerfection empowers you to produce compelling and flawless text that captivates your audience and leaves a lasting impression.

Experience the art of text perfection with this essential tool for every wordsmith and communicator

Features
--------

[](#features)

- Content analysis: Analyze text content and generate metrics such as word count, character count, unique words density, and average word length.
- Content rewriting: Rewrite text content using `OpenAI API`.
- Text formatting: Format text content generated from the `OpenAI API` response into HTML-compatible paragraphs, headings, and lists.

Installation
------------

[](#installation)

Install the TextPerfection plugin using Composer:

```
composer require moayadmgh/text-perfection
```

Usage
-----

[](#usage)

### - Full Usage

[](#--full-usage)

```
use Moayadmgh\TextPerfection\TextPerfection;

$content = 'TextPerfection is a powerful text analysis and manipulation plugin for PHP. It provides various functionalities to analyze, format, and detect plagiarism in text content.';
$TextPerfectionObj = new TextPerfection($content);

$textPerfectionResult = $TextPerfectionObj->get();
```

the above code example will store the following response in the `$textPerfectionResult` variable

```
return [
    'input_content' => $this->content,
    'text_analyzer' => [
        'word_count' => $this->textAnalyzer->getWordCount(),
        'unique_word_count' => $this->textAnalyzer->getUniqueWordCount(),
        'sentences_count' => $this->textAnalyzer->getSentencesCount(),
        'keyword_density' => $this->textAnalyzer->getKeywordDensity(),
        'average_word_length' => $this->textAnalyzer->getAverageWordLength(),
    ],
    'text_rewriter' => [
        'new_content' => $this->textRewriter->getNewContent(),
    ],
    'text_formatter' => [
        'formatted_content' => $this->textFormatter->getFormattedText(),
    ]
];
```

It is also possible to access each functionality separately

### - Content Analysis

[](#--content-analysis)

```
use Moayadmgh\TextPerfection\ContentAnalyzer;

$content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";

$analyzer = new ContentAnalyzer();
$result = $analyzer->analyze($content);

echo "Word Count: " . $result->getWordCount() . PHP_EOL;
echo "Character Count: " . $result->getCharacterCount() . PHP_EOL;
echo "Average Word Length: " . $result->getAverageWordLength() . PHP_EOL;
echo "UniqueWordCount: " . $result->getUniqueWordCount() . PHP_EOL;
echo "Sentences Count: " . $result->getSentencesCount() . PHP_EOL;
echo "Keyword Density: " . $result->getKeywordDensity() . PHP_EOL;
```

### - Content Rewriting

[](#--content-rewriting)

```
use Moayadmgh\TextPerfection\ContentRewriter;

$content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";

$rewriter = new ContentRewriter();
$rewriter->rewrite($content);
$rewrittenContent = $rewriter->getNewContent();

echo $rewrittenContent . PHP_EOL;
```

This new content will be rendered at first in the same format from the OpenAI API response

### - Content Reformatting

[](#--content-reformatting)

```
use Moayadmgh\TextPerfection\TextFormatter;

$content = "# This is going to be H1\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n- List item number 1\n- List item number 2";

$formatter = new TextFormatter();
$formatter->format($content);
$formattedContent = $formatter->getFormattedText();

echo $formattedContent . PHP_EOL;
```

Configuration
-------------

[](#configuration)

The TextPerfection plugin can be configured by creating a `.env` file in the root of your project. Here's an example configuration:

```
OPENAI_API_KEY=__OPEN_AI_API_KEY__
OPENAI_ORGANIZATION=__OPEN_AI_ORGANIZATION_KEY__
```

Make sure to set the corresponding API keys in your environment variables or use the .env file.

Contributing
------------

[](#contributing)

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License
-------

[](#license)

This plugin is open-source and released under the MIT License.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1141d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e5f9dc751e156f7603379e2c63131205f78716ef63c4b18ecf9fb901582bb21e?d=identicon)[moayad.mgh](/maintainers/moayad.mgh)

---

Top Contributors

[![moayadmgh](https://avatars.githubusercontent.com/u/104713862?v=4)](https://github.com/moayadmgh "moayadmgh (20 commits)")

---

Tags

phpopenai

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/moayadmgh-text-perfection/health.svg)

```
[![Health](https://phpackages.com/badges/moayadmgh-text-perfection/health.svg)](https://phpackages.com/packages/moayadmgh-text-perfection)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M89](/packages/openai-php-laravel)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k409.0k6](/packages/theodo-group-llphant)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[eliashaeussler/typo3-solver

Solver - Extends TYPO3's exception handling with AI generated solutions. Problems can also be solved from command line. Several OpenAI parameters are configurable and prompts and solution providers can be customized as desired.

302.1k](/packages/eliashaeussler-typo3-solver)

PHPackages © 2026

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