PHPackages                             ami-praha/ai-text-tool - 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. ami-praha/ai-text-tool

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

ami-praha/ai-text-tool
======================

OpenAI-powered text operations for Laravel with multilingual language packs.

v0.0.2(4mo ago)01MITPHPPHP ^8.2

Since Feb 12Pushed 4mo agoCompare

[ Source](https://github.com/AMI-Praha-a-s/ai-text-tool)[ Packagist](https://packagist.org/packages/ami-praha/ai-text-tool)[ RSS](/packages/ami-praha-ai-text-tool/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

AmiPraha AiTextTool
===================

[](#amipraha-aitexttool)

`AmiPraha\AiTextTool` is a Laravel package for OpenAI-powered text operations with multilingual language packs.

Features
--------

[](#features)

- Text summarization with requested output length.
- Headline generation with requested max length.
- Translation using the same output language resolution as all other operations.
- Text repair (grammar, punctuation, readability improvements).
- Native language packs for multiple languages to improve output quality with non-English source text.

Supported Languages
-------------------

[](#supported-languages)

Languages are defined by the `AmiPraha\AiTextTool\Language` enum:

- `Language::English`
- `Language::Czech`
- `Language::Slovak`
- `Language::German`
- `Language::Spanish`

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

[](#installation)

```
composer require ami-praha/ai-text-tool
```

Publish package config:

```
php artisan vendor:publish --tag=ai-text-tool-config
```

Optional: publish language files so you can customize them:

```
php artisan vendor:publish --tag=ai-text-tool-languages
```

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

[](#configuration)

File: `config/ai-text-tool.php`

- `default_language`: default language used by package (must match a `Language` enum value).
- `custom_language_path`: optional directory with language files that override package language files.
- `openai_api_key`: OpenAI API key used for chat completion requests.
- `openai_model`: OpenAI model used by package operations.
- `openai_base_url`: optional OpenAI-compatible base URL (useful for gateways/proxies).
- `timeout`: HTTP timeout in seconds.

Example:

```
return [
    'default_language' => 'english',
    'custom_language_path' => resource_path('ai-text-tool/languages'),
    'openai_api_key' => env('OPENAI_API_KEY'),
    'openai_model' => 'gpt-4.1-mini',
    'openai_base_url' => 'https://api.openai.com/v1',
    'timeout' => 60,
];
```

Environment variables:

```
OPENAI_API_KEY=your-api-key
AI_TEXT_TOOL_LANGUAGE=english
AI_TEXT_TOOL_LANGUAGE_PATH=/full/path/to/language/files
AI_TEXT_TOOL_OPENAI_MODEL=gpt-4.1-mini
AI_TEXT_TOOL_OPENAI_BASE_URL=https://api.openai.com/v1
AI_TEXT_TOOL_TIMEOUT=60
```

Usage
-----

[](#usage)

```
use AmiPraha\AiTextTool\Facades\AiTextTool;
use AmiPraha\AiTextTool\Language;

$summary = AiTextTool::summarize($sourceText, 450);
$headline = AiTextTool::headline($sourceText, 50);
$translation = AiTextTool::translate($sourceText);
$repaired = AiTextTool::repair($sourceText);
```

### Fluent per-call output language override

[](#fluent-per-call-output-language-override)

All operations use the configured `default_language` for output. Use `usingLanguage()` to override the output language per call:

```
$summary = AiTextTool::usingLanguage(Language::Czech)->summarize($sourceText, 450);
$headline = AiTextTool::usingLanguage(Language::German)->headline($sourceText, 50);
$translation = AiTextTool::usingLanguage(Language::Slovak)->translate($sourceText);
```

The override is immutable and per-call, so it does not change global config defaults.

### Optional source language hint

[](#optional-source-language-hint)

Use `fromLanguage()` to tell the LLM what language the source text is written in. This is optional -- when not provided, the model detects the source language automatically.

```
$translation = AiTextTool::usingLanguage(Language::German)->fromLanguage(Language::Czech)->translate($sourceText);
$summary = AiTextTool::fromLanguage(Language::Czech)->summarize($sourceText, 300);
```

Both `usingLanguage()` and `fromLanguage()` are immutable and can be chained in any order.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 12+
- OpenAI API key.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance75

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Every ~0 days

Total

2

Last Release

141d ago

### Community

Maintainers

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

---

Top Contributors

[![desthercz](https://avatars.githubusercontent.com/u/25509616?v=4)](https://github.com/desthercz "desthercz (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ami-praha-ai-text-tool/health.svg)

```
[![Health](https://phpackages.com/badges/ami-praha-ai-text-tool/health.svg)](https://phpackages.com/packages/ami-praha-ai-text-tool)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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