1tomany / php-ai-bundle
Symfony bundle that provides bindings for the 1tomany/php-ai package
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/1tomany/php-ai-bundle
Requires
- php: >=8.4
- 1tomany/php-ai: ^0.0.5
- symfony/config: ^7.2|^8.0
- symfony/dependency-injection: ^7.2|^8.0
- symfony/http-kernel: ^7.2|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.93
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.5
This package is auto-updated.
Last update: 2026-02-07 03:59:12 UTC
README
This package wraps the 1tomany/php-ai library into an easy to use Symfony bundle.
Installation
Install the bundle using Composer:
composer require 1tomany/php-ai-bundle
Configuration
Create a file named php_ai.yaml in config/packages/ and add the following lines:
php_ai: gemini: api_key: '%env(GEMINI_API_KEY)%' # http_client: 'http_client' # serializer: 'serializer' openai: api_key: '%env(OPENAI_API_KEY)%' # http_client: 'http_client' # serializer: 'serializer' when@dev: php_ai: mock: enabled: true
By default, the http_client and serializer properties in the gemini and openai blocks use the @http_client and @serializer services defined in a standard Symfony application. You're free to use your own scoped HTTP Client or Serializer services.
If you wish to disable a vendor, simply delete the configuration block from the file. For example, if your application only uses Gemini, you would delete the openai block:
php_ai: gemini: api_key: '%env(GEMINI_API_KEY)%'
You'll also have to define the API keys in your .env file or by using the Symfony Secrets component.
Credits
License
The MIT License