xmon-org / ai-content-bundle
Symfony bundle for AI content generation (text and images) with provider fallback
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/xmon-org/ai-content-bundle
Requires
- php: >=8.2
- psr/log: ^3.0
- symfony/framework-bundle: ^7.0
- symfony/http-client: ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.50
- phpstan/phpstan: ^1.10
- phpstan/phpstan-symfony: ^1.3
- phpunit/phpunit: ^10.0|^11.0
- symfony/phpunit-bridge: ^7.0
- twig/twig: ^3.0
Suggests
- sonata-project/admin-bundle: Required for admin UI features (^4.0)
- sonata-project/media-bundle: Required for image storage with SonataMedia (^4.0)
This package is auto-updated.
Last update: 2025-12-22 16:19:44 UTC
README
Symfony 7 bundle for AI content generation (text and images) with automatic fallback between providers.
Features
- Text generation with Gemini, OpenRouter, Pollinations
- Image generation with Pollinations (Flux model)
- Automatic fallback between providers
- Style presets for consistent image generation
- Configurable prompt templates for text generation
- Prompt variants with intelligent content-based selection
- SonataMedia integration (optional)
- Sonata Admin integration with image regeneration UI (optional)
Requirements
- PHP >= 8.2
- Symfony >= 7.0
- symfony/http-client
Quick Start
1. Installation
composer require xmon-org/ai-content-bundle
2. Configuration
# config/packages/xmon_ai_content.yaml xmon_ai_content: text: providers: pollinations: enabled: true image: providers: pollinations: enabled: true
3. Generate Text
use Xmon\AiContentBundle\Service\AiTextService; class MyService { public function __construct( private readonly AiTextService $aiTextService, ) {} public function summarize(string $content): string { $result = $this->aiTextService->generate( systemPrompt: 'You are a helpful assistant.', userMessage: "Summarize: {$content}", ); return $result->getText(); } }
4. Generate Image
use Xmon\AiContentBundle\Service\AiImageService; class MyService { public function __construct( private readonly AiImageService $aiImageService, ) {} public function generateImage(): void { $result = $this->aiImageService->generate( prompt: 'A serene Japanese dojo with morning light', ); file_put_contents('image.png', $result->getBytes()); } }
Documentation
Installation & Setup
- Installation Guide - Full setup instructions
Guides
- Text Generation - Generate text with AI
- Image Generation - Generate images with AI
- Styles & Presets - Control image styles
- Style Providers - Database-backed style configuration
- Prompt Templates - Configurable prompts with variants
- Custom Providers - Add your own providers
- Admin Integration - Sonata Admin integration
Reference
- Configuration - Full YAML reference
- Providers - Available AI providers
- Fallback System - How automatic fallback works
- Architecture - Bundle structure
Development
- Development Guide - Local setup and commands
Available Providers
Text
| Provider | Requires API Key | Notes |
|---|---|---|
| Gemini | Yes | Recommended, fast |
| OpenRouter | Yes | Multiple models |
| Pollinations | Optional | Always available, higher rate limits with key |
Image
| Provider | Requires API Key | Notes |
|---|---|---|
| Pollinations | Optional | Flux model |
Debug Command
bin/console xmon:ai:debug
Shows configured providers, styles, presets, and prompt templates.
Roadmap
- Phase 1: Base structure + Pollinations
- Phase 2: SonataMedia integration
- Phase 3: Text providers (Gemini, OpenRouter, Pollinations)
- Phase 4: Styles/presets system (ImageOptionsService, PromptBuilder)
- Phase 5: Configurable prompts (PromptTemplateService)
- Phase 6: Admin regeneration UI (Form Types, Controller, Templates)
- Phase 7: Aikido project migration
- Phase 8: Packagist publication
License
MIT