PHPackages                             xddesigners/silverstripe-ai - 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. xddesigners/silverstripe-ai

ActiveSilverstripe-vendormodule

xddesigners/silverstripe-ai
===========================

Core AI platform integration for Silverstripe using Symfony AI

1.0.0(1w ago)051BSD-3-ClausePHP

Since Mar 13Pushed 1w agoCompare

[ Source](https://github.com/xddesigners/silverstripe-ai)[ Packagist](https://packagist.org/packages/xddesigners/silverstripe-ai)[ RSS](/packages/xddesigners-silverstripe-ai/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (9)Versions (2)Used By (1)

silverstripe-ai
===============

[](#silverstripe-ai)

Core AI platform integration for SilverStripe, built on [Symfony AI](https://symfony.com/doc/current/ai.html). Provides a unified `AIClient` service and a `/ai/generate` endpoint that works with OpenAI, Anthropic, Azure OpenAI, Google Vertex AI, and OpenRouter.

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

[](#requirements)

- SilverStripe Framework `^6`
- PHP `^8.1`

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

[](#installation)

```
composer require xddesigners/silverstripe-ai
```

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

[](#configuration)

Add the following to your `.env` file:

```
AI_PLATFORM_TYPE="openai"   # openai | anthropic | azure | vertex | openrouter
AI_MODEL="gpt-4o-mini"
AI_API_KEY="sk-xxx"
```

### Supported platforms and models

[](#supported-platforms-and-models)

Platform typeExample models`openai``gpt-4o`, `gpt-4o-mini`, `gpt-3.5-turbo``anthropic``claude-opus-4-6`, `claude-sonnet-4-6`, `claude-haiku-4-5``azure``gpt-4o`, `gpt-4o-mini``vertex``gemini-1.5-pro``openrouter`any model available via OpenRouter### Optional YAML configuration

[](#optional-yaml-configuration)

You can override `AIClient` defaults in YAML:

```
XD\SilverstripeAI\Services\AIClient:
  max_text_length: 5000
  max_instructions_length: 1000
  default_instructions: 'You are a helpful assistant and SEO expert.'
```

Usage
-----

[](#usage)

### In PHP

[](#in-php)

Inject or instantiate `AIClient` and call one of its two methods:

```
use XD\SilverstripeAI\Services\AIClient;

$client = AIClient::create();

// Generate a plain text response
$result = $client->generateText('Write a short intro for our homepage.');

// Generate a keyed set of fields from context data
$result = $client->generateFields(
    context: ['Title' => 'My Page', 'Content' => 'Existing body text…'],
    fields: ['Title', 'Content', 'MetaDescription'],
    instructions: 'Improve the content for SEO.'
);
// Returns: ['Title' => '…', 'Content' => '…', 'MetaDescription' => '…']
```

### Via the HTTP endpoint

[](#via-the-http-endpoint)

The module registers a `/ai/generate` route that accepts `POST` requests.

**Text mode**

```
POST /ai/generate
mode=text&text=Write+a+short+intro&instructions=Keep+it+friendly

```

Response:

```
{ "result": "…" }
```

**Fields mode**

```
POST /ai/generate
mode=fields
&context[Title]=My+Page
&context[Content]=Existing+body+text
&fields[]=Title
&fields[]=Content
&fields[]=MetaDescription
&instructions=Improve+for+SEO

```

Response:

```
{ "fields": { "Title": "…", "Content": "…", "MetaDescription": "…" } }
```

**Error responses**

StatusMeaning`400`Missing or invalid input`429`Rate limit exceeded (includes `retry_after_seconds`)`500`AI generation failedExtending the controller
------------------------

[](#extending-the-controller)

By default `AIController::assertAccess()` calls `Security::permissionFailure()`, which means the endpoint is only accessible to logged-in CMS users. Subclass the controller to add your own permission logic:

```
use XD\SilverstripeAI\Controllers\AIController;

class MyAIController extends AIController
{
    protected function assertAccess(): void
    {
        // e.g. require a specific permission
        if (!Permission::check('MY_AI_PERMISSION')) {
            parent::assertAccess();
        }
    }
}
```

Then update the route in YAML:

```
SilverStripe\Control\Director:
  rules:
    'ai//$Action': 'MyAIController'
```

Suggested modules
-----------------

[](#suggested-modules)

- **[xddesigners/silverstripe-ai-assistant](https://github.com/xddesigners/silverstripe-ai-assistant)** — adds a ready-to-use AI Assistant tab to CMS edit forms, letting editors generate and preview AI-written content for any configured fields.

License
-------

[](#license)

BSD-3-Clause © [XD Designers](https://xd.nl)

###  Health Score

37

—

LowBetter than 84% of packages

Maintenance98

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

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

Unknown

Total

1

Last Release

8d ago

### Community

Maintainers

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

---

Top Contributors

[![RVXD](https://avatars.githubusercontent.com/u/1586761?v=4)](https://github.com/RVXD "RVXD (2 commits)")

---

Tags

symfonyaisilverstripeartificial intelligenceSymfony AI

### Embed Badge

![Health badge](/badges/xddesigners-silverstripe-ai/health.svg)

```
[![Health](https://phpackages.com/badges/xddesigners-silverstripe-ai/health.svg)](https://phpackages.com/packages/xddesigners-silverstripe-ai)
```

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

46554.9k4](/packages/deepseek-php-deepseek-php-client)

PHPackages © 2026

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