Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Symfony Ai Context Bundle Laravel Package

ai-context/symfony-ai-context-bundle

View on GitHub
Deep Wiki
Context7

Symfony AI Context Bundle

Latest Version on Packagist Total Downloads Tests PHPStan

🔍 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


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

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

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

Feature Description
Entities Doctrine field types and associations
Services Public methods with full type signatures
Controllers Public actions and routes
Routes Names, methods, paths, controllers
Repositories Public custom methods
Events Event class names and dispatching metadata
Forms Field names, types and options

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

 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 <name service> service.

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

Contributing

PRs welcome! To contribute:

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

License

Released under the MIT License

Credits

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui