PHPackages                             ai-context/symfony-ai-context-bundle - 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. ai-context/symfony-ai-context-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

ai-context/symfony-ai-context-bundle
====================================

Symfony bundle to generate AI-readable project context.

v0.5.7(1y ago)161062MITPHPPHP &gt;=8.2CI passing

Since May 4Pushed 3w ago1 watchersCompare

[ Source](https://github.com/ai-context-lab/symfony-ai-context-bundle)[ Packagist](https://packagist.org/packages/ai-context/symfony-ai-context-bundle)[ RSS](/packages/ai-context-symfony-ai-context-bundle/feed)WikiDiscussions main Synced today

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

Symfony AI Context Bundle
=========================

[](#symfony-ai-context-bundle)

[![Latest Version on Packagist](https://camo.githubusercontent.com/24a893d129bf07b5c1b6ef444d8afeb34fb333fb902f862d450d9919a6d8f7ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61692d636f6e746578742f73796d666f6e792d61692d636f6e746578742d62756e646c652e737667)](https://packagist.org/packages/ai-context/symfony-ai-context-bundle)[![Total Downloads](https://camo.githubusercontent.com/7ca3f483bf9c7f4ddea34825b1aff39d806a0ab1caecc11adfff501eaaeda1af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61692d636f6e746578742f73796d666f6e792d61692d636f6e746578742d62756e646c652e737667)](https://packagist.org/packages/ai-context/symfony-ai-context-bundle)[![Tests](https://github.com/ai-context-lab/symfony-ai-context-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/ai-context-lab/symfony-ai-context-bundle/actions/workflows/ci.yml)[![PHPStan](https://github.com/ai-context-lab/symfony-ai-context-bundle/actions/workflows/phpstan.yml/badge.svg)](https://github.com/ai-context-lab/symfony-ai-context-bundle/actions/workflows/phpstan.yml)

> 🔍 Automatically generate a structured, AI-ready JSON context from your Symfony application — including entities, services, controllers, routes, repositories, and more. Perfect for feeding to LLMs like GPT for code understanding, generation, or assistance.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Supported extractors](#supported-extractors)
- [Output example](#output-example)
- [Example prompts](#example-prompts)
- [Contributing](#contributing)
- [License](#license)
- [Credits](#credits)

---

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

[](#installation)

```
composer require ai-context/symfony-ai-context-bundle --dev
```

Make sure the bundle is enabled (Symfony Flex should do this automatically):

```
// config/bundles.php
return [
    AiContextBundle\AiContextBundle::class => ['dev' => true, 'test' => true],
];
```

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

[](#configuration)

Configure the bundle in `config/packages/ai_context.yaml` you can edit the default values:

```
ai_context:
    output_dir: '%kernel.project_dir%/var/ai_context'
    output_filename: 'ai-context.json'
    output_dir_checksum: '%kernel.project_dir%/var/ai-context/ai-context-checksum.json'
    include:
        routes: true
        entities: true
        services: true
        controllers: true
        repositories: true
        events: true
        forms: true
    paths:
        entities: ['%kernel.project_dir%/src/Entity']
        services: ['%kernel.project_dir%/src/Service']
        controllers: ['%kernel.project_dir%/src/Controller']
        repositories: ['%kernel.project_dir%/src/Repository']
        events: ['%kernel.project_dir%/src/Event']
        forms: ['%kernel.project_dir%/src/Form']
```

Usage
-----

[](#usage)

Generate the AI context:

```
php bin/console ai-context:generate
```

The command outputs a structured JSON file (by default in var/ai\_context/ai-context.json) including:

Supported extractors
--------------------

[](#supported-extractors)

FeatureDescriptionEntitiesDoctrine field types and associationsServicesPublic methods with full type signaturesControllersPublic actions and routesRoutesNames, methods, paths, controllersRepositoriesPublic custom methodsEventsEvent class names and dispatching metadataFormsField names, types and optionsOutput example
--------------

[](#output-example)

```
{
    "entities": [
        {
            "entity": "App\\Entity\\Article",
            "fields": {
                "id": "integer",
                "name": "string",
                "createdAt": "datetime_immutable",
                "updatedAt": "datetime_immutable"
            },
            "associations": {
                "category": "ManyToOne => App\\Entity\\Category",
                "inventories": "OneToMany => App\\Entity\\Inventory"
            }
        }
    ],
    "controllers": [
        {
            "class": "App\\Controller\\ArticleController",
            "short": "ArticleController",
            "methods": [
                {
                    "name": "new",
                    "parameters": [
                        "$request: Symfony\\Component\\HttpFoundation\\Request",
                        "$entityManager: Doctrine\\ORM\\EntityManagerInterface"
                    ],
                    "route": {
                        "path": "/article/new",
                        "methods": ["POST", "GET"],
                        "name": "app_article_new"
                    }
                }
            ]
        }
    ],
    "routes": [
        {
            "name": "app_article_new",
            "path": "/article/new",
            "methods": ["POST", "GET"],
            "controller": "App\\Controller\\ArticleController::new",
            "defaults": {},
            "requirements": {}
        }
    ],
    "services": [
        {
            "class": "App\\Service\\StockManagerService",
            "short": "StockManagerService",
            "methods": [
                {
                    "name": "processStock",
                    "parameters": [
                        {"name": "articleName", "type": "string"},
                        {"name": "quantity", "type": "int"},
                        {"name": "action", "type": "string"},
                        {"name": "categoryName", "type": "?string"},
                        {"name": "user", "type": "?App\\Entity\\User"}
                    ],
                    "returnType": "void"
                }
            ]
        }
    ]
}
```

Perfect to feed into LLMs like GPT for project understanding.

Then you can use the AI context in your preferred LLMs or AI tools to enhance your Symfony development experience.

Example prompts
---------------

[](#example-prompts)

```
 Can you give me a list of all the routes in my Symfony application?

 Generate a readme file with install process.

 List all services available with a quick description of each one.

 Give me full details of how work the  service.

```

Whatever you need, the AI context is here to help you!

Contributing
------------

[](#contributing)

PRs welcome! To contribute:

- Fork the repository
- Create a branch
- Write tests or improve extractors
- Submit a pull request

License
-------

[](#license)

Released under the MIT License

Credits
-------

[](#credits)

Developed with ❤️ by Guillaume Valadas Part of the AI Context Lab

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance74

Regular maintenance activity

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

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

Total

4

Last Release

370d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/03b6d6eaba5e15e4595545452064090de485ca3d93793934cc06d717524dc8ab?d=identicon)[Guillaume Valadas](/maintainers/Guillaume%20Valadas)

---

Top Contributors

[![GuillaumeValadas](https://avatars.githubusercontent.com/u/8961211?v=4)](https://github.com/GuillaumeValadas "GuillaumeValadas (51 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[metamodels/core

MetaModels core

10156.4k68](/packages/metamodels-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[mapbender/mapbender

Mapbender library

10418.3k8](/packages/mapbender-mapbender)

PHPackages © 2026

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