PHPackages                             el-schneider/statamic-auto-alt-text - 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. el-schneider/statamic-auto-alt-text

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

el-schneider/statamic-auto-alt-text
===================================

v2.0.3(2mo ago)16.1k↓42.9%1[2 PRs](https://github.com/el-schneider/statamic-auto-alt-text/pulls)PHPCI passing

Since May 4Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/el-schneider/statamic-auto-alt-text)[ Packagist](https://packagist.org/packages/el-schneider/statamic-auto-alt-text)[ Fund](https://www.buymeacoffee.com/el.schneider)[ RSS](/packages/el-schneider-statamic-auto-alt-text/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (30)Used By (0)

[![Auto Alt Text](images/aat_banner.png)](images/aat_banner.png)

Statamic Auto Alt Text
======================

[](#statamic-auto-alt-text)

> Automatically generate descriptive alt text for images in Statamic v5 using AI services via [Prism PHP](https://github.com/prism-php/prism)

⚠️ Upgrading from v0.x?
-----------------------

[](#️-upgrading-from-v0x)

**Breaking Changes in v1.0:** Moondream support has been removed. If you were using Moondream, switch to [Ollama](https://ollama.ai) with a vision model like `llava` for local processing, or choose from 7+ cloud providers (OpenAI, Anthropic, etc.).

**Migration is simple:** Replace your old config with the new `AUTO_ALT_TEXT_MODEL` format:

```
# Old (v0.x)
AUTO_ALT_TEXT_SERVICE=openai
OPENAI_MODEL=gpt-4.1

# New (v1.x)
AUTO_ALT_TEXT_MODEL=openai/gpt-4.1
```

See [Upgrading from v0.x](#upgrading-from-v0x) for full details.

Features
--------

[](#features)

- **Automatic Generation:** Generate alt text for assets using AI by listening for Statamic asset events
- **Multiple AI Providers:** Support for OpenAI, Anthropic, Ollama, Mistral, Groq, DeepSeek, and xAI via Prism PHP
- **Data Privacy:** Option to use local Ollama endpoints, keeping image data within your infrastructure
- **Asset Filtering:** Exclude sensitive or private assets from processing with global patterns, container-specific rules, or individual asset settings
- **Control Panel Integration:** Field Action to generate alt text for individual images
- **Bulk Processing:** Artisan Command for processing images individually or in batch

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

[](#installation)

```
composer require el-schneider/statamic-auto-alt-text
```

Publish the configuration file:

```
php artisan vendor:publish --tag="statamic-auto-alt-text-config"
```

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

[](#configuration)

Configure your AI provider in `.env`:

```
# Model format: provider/model-name
AUTO_ALT_TEXT_MODEL=openai/gpt-4.1

# API key (managed by Prism - see config/prism.php)
OPENAI_API_KEY=your_api_key_here
```

### Supported Providers

[](#supported-providers)

ProviderExample ModelEnvironment VariableOpenAI`openai/gpt-4.1``OPENAI_API_KEY`Anthropic`anthropic/claude-sonnet-4-5``ANTHROPIC_API_KEY`Ollama`ollama/llava`(local, no key needed)Mistral`mistral/pixtral-large-latest``MISTRAL_API_KEY`Groq`groq/llava-v1.5-7b-4096-preview``GROQ_API_KEY`DeepSeek`deepseek/deepseek-chat``DEEPSEEK_API_KEY`xAI`xai/grok-vision-beta``XAI_API_KEY`### Custom Providers

[](#custom-providers)

You can use any custom provider supported by Prism. First, register your custom provider in a service provider:

```
use App\Prism\Providers\MyCustomProvider;

public function boot(): void
{
    $this->app['prism-manager']->extend('my-provider', function ($app, $config) {
        return new MyCustomProvider(apiKey: $config['api_key']);
    });
}
```

Then configure it in your `.env`:

```
AUTO_ALT_TEXT_MODEL=my-provider/model-name
```

See [Prism's Custom Providers documentation](https://prismphp.com/advanced/custom-providers.html) for details on building and registering custom providers.

For advanced provider configuration (custom endpoints, timeouts, etc.), publish Prism's config:

```
php artisan vendor:publish --tag="prism-config"
```

### Non-English Captions

[](#non-english-captions)

You can customize the prompt to generate captions in your preferred language:

```
AUTO_ALT_TEXT_PROMPT="Beschreibe dieses Bild kurz und bündig, um einen Alternativtext für Barrierefreiheit bereitzustellen."
AUTO_ALT_TEXT_SYSTEM_MESSAGE="Du bist ein Barrierefreiheitsexperte, der kurze, beschreibende Alt-Texte für Bilder generiert. Antworte nur mit dem Alt-Text, ohne Einleitung oder Erklärungen."
```

Usage
-----

[](#usage)

### Automatic Generation

[](#automatic-generation)

The addon listens for configured Statamic events (default: `AssetUploaded` and `AssetSaving`). When an asset without alt text is detected, a background job is dispatched to generate it automatically using your configured AI service.

> **Important:** This feature requires Laravel's queue system with an asynchronous queue driver (e.g., `database`, `redis`, `sqs`) and a running queue worker (`php artisan queue:work`). The default `sync` driver won't work for background processing.

Optionally customize the queue configuration:

```
# Optional: Defaults to your application's default queue connection
AUTO_ALT_TEXT_QUEUE_CONNECTION=redis

# Optional: Defaults to the default queue name for the connection
AUTO_ALT_TEXT_QUEUE_NAME=alt_text_generation
```

### Manual Generation

[](#manual-generation)

For existing assets or specific workflows:

1. **Field Action:** Edit an asset, find the `alt` text field, and click the "Generate Alt Text" action
2. **Statamic Action:** In an Asset container, use the "Generate Alt Text" action from the contextual menu
3. **CLI Command:** Process assets in bulk with:

```
php please auto-alt:generate
```

See `php please auto-alt:generate --help` for options to specify containers, assets, and overwriting behavior

### Using Local Ollama

[](#using-local-ollama)

For privacy or compliance reasons, you can run vision models locally with Ollama:

1. **Set up Ollama:** Install [Ollama](https://ollama.ai) and pull a vision model: `ollama pull llava`
2. **Configure the addon:**

```
AUTO_ALT_TEXT_MODEL=ollama/llava
```

3. **Configure Prism:** Publish Prism's config and set the Ollama endpoint:

```
php artisan vendor:publish --tag="prism-config"
```

Then update `config/prism.php`:

```
'ollama' => [
    'url' => env('OLLAMA_URL', 'http://localhost:11434'),
],
```

Generation Parameters
---------------------

[](#generation-parameters)

Fine-tune the AI generation with these environment variables:

```
AUTO_ALT_TEXT_MAX_TOKENS=100      # Maximum length of generated text
AUTO_ALT_TEXT_TEMPERATURE=0.7     # Creativity (0.0 = deterministic, 1.0 = creative)
AUTO_ALT_TEXT_TIMEOUT=60          # Request timeout in seconds
```

Upgrading from v0.x
-------------------

[](#upgrading-from-v0x)

If upgrading from v0.x, update your environment variables:

### Before (v0.x)

[](#before-v0x)

```
AUTO_ALT_TEXT_SERVICE=openai
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4.1
OPENAI_ENDPOINT=https://api.openai.com/v1/chat/completions
```

### After (v1.x)

[](#after-v1x)

```
AUTO_ALT_TEXT_MODEL=openai/gpt-4.1
OPENAI_API_KEY=sk-...
```

**Breaking changes:**

- Moondream support has been removed (use Ollama with llava for local processing)
- Config structure simplified: `services.openai.*` replaced with flat `model` setting
- Environment variables changed: `AUTO_ALT_TEXT_MODEL` replaces `AUTO_ALT_TEXT_SERVICE`

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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 ~14 days

Recently: every ~3 days

Total

23

Last Release

67d ago

Major Versions

v0.5.2 → v2.0.0-alpha.12025-09-06

v0.5.3 → v1.0.02026-01-28

v1.0.0 → v2.0.02026-01-28

v1.0.1 → v2.0.12026-02-25

v1.0.2 → v2.0.32026-03-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/81a231c7730414820ac67caf7b30bea0de0d6af3775ec941a07ee5dc697f442a?d=identicon)[mail@jonaslist.de](/maintainers/mail@jonaslist.de)

---

Top Contributors

[![el-schneider](https://avatars.githubusercontent.com/u/26460248?v=4)](https://github.com/el-schneider "el-schneider (77 commits)")[![ito-ito-ito-ito](https://avatars.githubusercontent.com/u/260886217?v=4)](https://github.com/ito-ito-ito-ito "ito-ito-ito-ito (7 commits)")

---

Tags

addonaistatamictagging

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/el-schneider-statamic-auto-alt-text/health.svg)

```
[![Health](https://phpackages.com/badges/el-schneider-statamic-auto-alt-text/health.svg)](https://phpackages.com/packages/el-schneider-statamic-auto-alt-text)
```

###  Alternatives

[statamic/ssg

Generate static sites with Statamic.

254302.4k](/packages/statamic-ssg)[statamic/seo-pro

65440.7k](/packages/statamic-seo-pro)[prism-php/relay

A Prism tool for interacting with MCP servers

15236.1k3](/packages/prism-php-relay)[jacksleight/statamic-bard-texstyle

17172.5k](/packages/jacksleight-statamic-bard-texstyle)[visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor.

20116.8k](/packages/visuellverstehen-statamic-classify)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)

PHPackages © 2026

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