PHPackages                             anastalal/filament-ai-rewriter - 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. anastalal/filament-ai-rewriter

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

anastalal/filament-ai-rewriter
==============================

AI-powered content rewriter for FilamentPHP

v1.0.2(3mo ago)221[2 PRs](https://github.com/anastalal/filament-ai-rewriter/pulls)MITPHPPHP ^8.3CI passing

Since Jan 23Pushed 1mo agoCompare

[ Source](https://github.com/anastalal/filament-ai-rewriter)[ Packagist](https://packagist.org/packages/anastalal/filament-ai-rewriter)[ Docs](https://github.com/anastalal/filament-ai-rewriter)[ GitHub Sponsors](https://github.com/anastalal)[ RSS](/packages/anastalal-filament-ai-rewriter/feed)WikiDiscussions main Synced 1mo ago

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

Filament AI Rewriter
====================

[](#filament-ai-rewriter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/28acab9447cb33da190930e52aadb185116394e1d49bf9aeb20b2d1abede3104/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e617374616c616c2f66696c616d656e742d61692d72657772697465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anastalal/filament-ai-rewriter)[![Total Downloads](https://camo.githubusercontent.com/4a674b0825c706f6e7d4326088ae52f0da37047292219a8ddfa24f3759c6613d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e617374616c616c2f66696c616d656e742d61692d72657772697465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anastalal/filament-ai-rewriter)[![License](https://camo.githubusercontent.com/a6c6b0e504e6c2b376577f4cac64cc328e5717902cdd7c002489774c62f7da95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616e617374616c616c2f66696c616d656e742d61692d72657772697465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anastalal/filament-ai-rewriter)

AI-powered content rewriting for FilamentPHP. Enhance your forms with intelligent text refinement, creative expansion, and natural translations directly within your Filament fields.

[![Filament AI Rewriter](image.png)](image.png)

Features
--------

[](#features)

- **Multi-Provider Support**: Seamlessly switch between OpenAI (GPT-4/3.5), Google Gemini, and Anthropic Claude.
- **Unified Macro API**: Add AI functionality to any text-based field using a simple `->withAi()` macro.
- **Smart Input Filtering**: Automatically hides AI actions on sensitive or strictly formatted fields (Password, Email, Numeric, etc.) to ensure data integrity.
- **Context-Aware Lengths**: Intelligent response limits tailored to the field type (concise for `TextInput`, detailed for `Textarea` and Editors).
- **SEO Keywords**: Naturally incorporate global or field-specific keywords into the rewritten content.
- **No Manual Bolding**: Explicitly instructs AI to avoid unnecessary bolding or highlighting of keywords.
- **Smart Caching**: Temperature-aware caching system with tag support for selective cache clearing.
- **Selective Cache Management**: CLI utility to clear only AI-generated results from your cache.
- **Fully Multilingual**: Native support for English and Arabic with extensible translation system.

Support
-------

[](#support)

- **Filament**: v3.x, v4.x, and v5.x

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

[](#installation)

You can install the package via composer:

```
composer require anastalal/filament-ai-rewriter
```

Publish the configuration file:

```
php artisan vendor:publish --tag="filament-ai-rewriter-config"
```

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

[](#configuration)

Add your API keys to your `.env` file:

```
AI_REWRITER_PROVIDER=openai
OPENAI_API_KEY=your-api-key-here

# Optional: Global SEO keywords
AI_REWRITER_GLOBAL_KEYWORDS="your, main, keywords"
```

The configuration file allows you to customize providers, models, default styles, and detailed AI prompts.

Usage
-----

[](#usage)

### Simple Usage

[](#simple-usage)

Add AI rewrite capability to any `TextInput`, `Textarea`, `RichEditor`, or `MarkdownEditor`:

```
use Filament\Forms\Components\Textarea;

Textarea::make('description')
    ->withAi()
```

### Advanced Usage

[](#advanced-usage)

Customize the AI behavior for specific fields:

```
use Filament\Forms\Components\RichEditor;

RichEditor::make('content')
    ->withAi([
        'style' => 'creative',
        'keywords' => 'sale, unique, offer',
        'temperature' => 0.8,
        'max_tokens' => 2000,
    ])
```

### Global Keywords

[](#global-keywords)

Keywords set in `config/filament-ai-rewriter.php` are automatically used in every request. Keywords provided via the `withAi()` macro will be merged with the global ones.

CLI Commands
------------

[](#cli-commands)

Clear all AI-generated results from the cache:

```
php artisan filament-ai-rewriter:clear-cache
```

**Note**: Selective clearing requires a cache driver that supports tags (e.g., Redis or Memcached). Use `--force` to clear the entire application cache if your driver doesn't support tags:

```
php artisan filament-ai-rewriter:clear-cache --force
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [anastalal](https://github.com/anastalal)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance87

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

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

Every ~7 days

Total

3

Last Release

96d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.2PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/163d9263b9d61588ec623a8db26f56005024e4335c30302da2638a6b8143c142?d=identicon)[anastalal](/maintainers/anastalal)

---

Top Contributors

[![anastalal](https://avatars.githubusercontent.com/u/59017023?v=4)](https://github.com/anastalal "anastalal (8 commits)")

---

Tags

laravelanastalalfilament-ai-rewriter

### Embed Badge

![Health badge](/badges/anastalal-filament-ai-rewriter/health.svg)

```
[![Health](https://phpackages.com/badges/anastalal-filament-ai-rewriter/health.svg)](https://phpackages.com/packages/anastalal-filament-ai-rewriter)
```

###  Alternatives

[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

320392.1k17](/packages/codewithdennis-filament-select-tree)[ralphjsmit/laravel-filament-components

A collection of reusable components for Filament.

10972.2k2](/packages/ralphjsmit-laravel-filament-components)[schmeits/filament-character-counter

This is a Filament character counter TextField and Textarea form field for Filament v4 and v5

33184.7k6](/packages/schmeits-filament-character-counter)[defstudio/filament-searchable-input

A searchable autocomplete input for Filament forms

3212.4k](/packages/defstudio-filament-searchable-input)[codebar-ag/laravel-filament-json-field

A Laravel Filament JSON Field integration with CodeMirror support

1124.1k](/packages/codebar-ag-laravel-filament-json-field)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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