PHPackages                             symfony/ai-demo - 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. [Framework](/categories/framework)
4. /
5. symfony/ai-demo

ActiveProject[Framework](/categories/framework)

symfony/ai-demo
===============

Symfony AI Demo Application

v0.6.0(2mo ago)40109MITPHPPHP &gt;=8.4

Since Dec 24Pushed 1mo agoCompare

[ Source](https://github.com/symfony/ai-demo)[ Packagist](https://packagist.org/packages/symfony/ai-demo)[ Fund](https://symfony.com/sponsor)[ GitHub Sponsors](https://github.com/fabpot)[ RSS](/packages/symfony-ai-demo/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (52)Versions (8)Used By (0)

Symfony AI - Demo Application
=============================

[](#symfony-ai---demo-application)

Symfony application demoing Symfony AI components.

Examples
--------

[](#examples)

[![demo.png](demo.png)](demo.png)

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

[](#requirements)

What you need to run this demo:

- Internet Connection
- Terminal &amp; Browser
- [Git](https://git-scm.com/) &amp; [GitHub Account](https://github.com)
- [Docker](https://www.docker.com/) with [Docker Compose Plugin](https://docs.docker.com/compose/)
- Your Favorite IDE or Editor
- An [OpenAI API Key](https://platform.openai.com/docs/api-reference/create-and-export-an-api-key)

Technology
----------

[](#technology)

This small demo sits on top of following technologies:

- [PHP &gt;= 8.4](https://www.php.net/releases/8.4/en.php)
- [Symfony 7.3 incl. Twig, Asset Mapper &amp; UX](https://symfony.com/)
- [Bootstrap 5](https://getbootstrap.com/docs/5.0/getting-started/introduction/)
- [OpenAI's GPT &amp; Embeddings](https://platform.openai.com/docs/overview)
- [ChromaDB Vector Store](https://www.trychroma.com/)
- [FrankenPHP](https://frankenphp.dev/)

Setup
-----

[](#setup)

The setup is split into three parts, the Symfony application, the OpenAI configuration, and initializing the Chroma DB.

### 1. Symfony App

[](#1-symfony-app)

Checkout the repository, start the docker environment and install dependencies:

```
git clone git@github.com:symfony/ai-demo.git
cd ai-demo
composer install
docker compose up -d
symfony serve -d
```

Now you should be able to open  in your browser, and the chatbot UI should be available for you to start chatting.

Note

You might have to bypass the security warning of your browser with regard to self-signed certificates.

### 2. OpenAI Configuration

[](#2-openai-configuration)

For using GPT and embedding models from OpenAI, you need to configure an OpenAI API key as environment variable. This requires you to have an OpenAI account, create a valid API key and set it as `OPENAI_API_KEY` in `.env.local` file.

```
echo "OPENAI_API_KEY='sk-...'" > .env.local
```

Verify the success of this step by running the following command:

```
symfony console debug:dotenv
```

You should be able to see the `OPENAI_API_KEY` in the list of environment variables.

### 3. Chroma DB Initialization

[](#3-chroma-db-initialization)

The [Chroma DB](https://www.trychroma.com/) is a vector store that is used to store embeddings of the chatbot's context.

To initialize the Chroma DB, you need to run the following command:

```
symfony console ai:store:index blog -vv
```

Now you should be able to retrieve documents from the store:

```
symfony console ai:store:retrieve blog "Week of Symfony"
```

**Don't forget to set up the project in your favorite IDE or editor.**

Functionality
-------------

[](#functionality)

- The chatbot application is a simple and small Symfony 7.3 application.
- The UI is coupled to a [Twig LiveComponent](https://symfony.com/bundles/ux-live-component/current/index.html), that integrates different `Chat` implementations on top of the user's session.
- You can reset the chat context by hitting the `Reset` button in the top right corner.
- You find three different usage scenarios in the upper navbar.

### MCP

[](#mcp)

Demo MCP server added with a `current-time` tool to return the current time, with an optional format string.

To add the server, add the following configuration to your MCP Client's settings, e.g. your IDE:

```
{
    "servers": {
        "symfony": {
            "command": "php",
            "args": [
                "/your/full/path/to/bin/console",
                "mcp:server"
            ]
        }
    }
}
```

#### Testing the MCP Server

[](#testing-the-mcp-server)

You can test the MCP server by running the following command to start the MCP client:

```
symfony console mcp:server
```

**With plain JSON RPC requests**

Then, you can initialize the MCP session with the following JSON RPC request:

```
{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": { "name": "demo-client", "version": "dev" } } }
```

And, to request the list of available tools:

```
{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }
```

**With MCP Inspector**

For testing, you can also use the [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector):

```
npx @modelcontextprotocol/inspector php bin/console mcp:server
```

Which opens a web UI to interactively test the MCP server.

AI Mate - MCP Development Assistant
-----------------------------------

[](#ai-mate---mcp-development-assistant)

[Symfony AI Mate](https://github.com/symfony/ai-mate) is an MCP (Model Context Protocol) server that provides AI assistants with Symfony-specific development capabilities.

### Installation &amp; Setup

[](#installation--setup)

**This demo is already configured!** For new projects you can set up AI Mate as follows:

```
# Install AI Mate
composer require --dev symfony/ai-mate

# Initialize configuration
vendor/bin/mate init

# Discover available tools
vendor/bin/mate discover
```

### MCP Client Configuration

[](#mcp-client-configuration)

The `mcp.json` file in the project root enables automatic MCP client detection:

```
{
  "mcpServers": {
    "symfony-ai-mate": {
      "command": "./vendor/bin/mate",
      "args": ["serve"]
    }
  }
}
```

For other projects, add AI Mate to your MCP client settings (e.g., `~/.claude/mcp.json`, IDE settings, etc.).

### Custom Capability Example

[](#custom-capability-example)

This demo includes a **`symfony-ai-features`** tool (see `mate/SymfonyAiFeaturesTool.php`) that analyzes the project's AI configuration and reports all available platforms, agents, tools, stores, and packages.

**Try it in your MCP-enabled chat:**

> "Which Symfony AI features are available in this demo?"
>
> "What AI agents are configured in this project?"
>
> "Show me all the Symfony AI tools and their configuration"
>
> "What is the current PHP version used in this project?"
>
> "Is the php extension intl installed?"

The AI assistant will use the `symfony-ai-features` and other MCP tool to provide detailed information about project internals.

### Creating Custom Tools

[](#creating-custom-tools)

Create tools in `mate/src/` and register them in `mate/config.php`. See the [AI Mate documentation](https://symfony.com/doc/current/ai/components/mate.html) for detailed guides.

### Testing

[](#testing)

```
# Test with MCP Inspector
npx @modelcontextprotocol/inspector ./vendor/bin/mate serve
```

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance88

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~11 days

Total

7

Last Release

74d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47313?v=4)[Fabien Potencier](/maintainers/fabpot)[@fabpot](https://github.com/fabpot)

---

Top Contributors

[![chr-hertel](https://avatars.githubusercontent.com/u/2852185?v=4)](https://github.com/chr-hertel "chr-hertel (65 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (62 commits)")[![wachterjohannes](https://avatars.githubusercontent.com/u/1464615?v=4)](https://github.com/wachterjohannes "wachterjohannes (11 commits)")[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (9 commits)")[![valtzu](https://avatars.githubusercontent.com/u/652734?v=4)](https://github.com/valtzu "valtzu (4 commits)")[![camilleislasse](https://avatars.githubusercontent.com/u/34024380?v=4)](https://github.com/camilleislasse "camilleislasse (2 commits)")[![tom-hart-sky-uk](https://avatars.githubusercontent.com/u/219799917?v=4)](https://github.com/tom-hart-sky-uk "tom-hart-sky-uk (2 commits)")[![smnandre](https://avatars.githubusercontent.com/u/1359581?v=4)](https://github.com/smnandre "smnandre (1 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (1 commits)")[![welcoMattic](https://avatars.githubusercontent.com/u/773875?v=4)](https://github.com/welcoMattic "welcoMattic (1 commits)")[![Amoifr](https://avatars.githubusercontent.com/u/31698966?v=4)](https://github.com/Amoifr "Amoifr (1 commits)")[![xavierleune](https://avatars.githubusercontent.com/u/2320425?v=4)](https://github.com/xavierleune "xavierleune (1 commits)")[![bigdevlarry](https://avatars.githubusercontent.com/u/29729601?v=4)](https://github.com/bigdevlarry "bigdevlarry (1 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (1 commits)")[![Guikingone](https://avatars.githubusercontent.com/u/13744329?v=4)](https://github.com/Guikingone "Guikingone (1 commits)")[![ngrie](https://avatars.githubusercontent.com/u/42877936?v=4)](https://github.com/ngrie "ngrie (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![santysisi](https://avatars.githubusercontent.com/u/107224084?v=4)](https://github.com/santysisi "santysisi (1 commits)")

---

Tags

aillmsymfonysymfony-ai

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/symfony-ai-demo/health.svg)

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

###  Alternatives

[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[forumify/forumify-platform

121.8k11](/packages/forumify-forumify-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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