moayadmgh/text-perfection
Composer 安装命令:
composer require 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 masterpiec
README 文档
README
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
- 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 APIresponse into HTML-compatible paragraphs, headings, and lists.
Installation
Install the TextPerfection plugin using Composer:
composer require moayadmgh/text-perfection
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
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
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
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
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
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
License
This plugin is open-source and released under the MIT License.
moayadmgh/text-perfection 适用场景与选型建议
moayadmgh/text-perfection 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 05 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「openai」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 moayadmgh/text-perfection 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moayadmgh/text-perfection 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 moayadmgh/text-perfection 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP 8.0+ OpenAI API client with fully typed/documented requests+responses models, guzzle and symfony/http-client support and async/parallel requests.
Estimate AI API costs before making expensive calls
A powerful package that seamlessly integrates OpenAI's advanced AI capabilities into your Laravel applications. This package offers quick setup and intuitive configuration to leverage AI models for chat, embeddings, and more.
AI discussion summaries for Flarum with real-time streaming.
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-19