Weave 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
Php Ai Bundle

Php Ai Bundle Laravel Package

1tomany/php-ai-bundle

View on GitHub
Deep Wiki
Context7

Symfony bundle that provides bindings for the 1tomany/php-ai package

Frequently asked questions about Php Ai Bundle
What is 1tomany/php-ai-bundle?
It is a Symfony bundle that wraps the 1tomany/php-ai library and registers its AI and LLM services in Symfony's dependency injection container. It adds bundle configuration for providers such as OpenAI and Gemini and wires Symfony's http_client and serializer into the underlying transport. It is not a standalone AI client; the core query and file resources come from 1tomany/php-ai.
Does 1tomany/php-ai-bundle work with Laravel?
No, this package is a Symfony bundle, so it is designed for Symfony applications and Symfony's service container. Laravel applications should use the underlying 1tomany/php-ai library directly or look for a Laravel-specific wrapper. The README does not describe any Laravel service provider or facade.
How do I install 1tomany/php-ai-bundle?
Install it with Composer using composer require 1tomany/php-ai-bundle. The README does not list extra manual registration steps beyond normal Symfony bundle discovery. After installation, create config/packages/onetomany_ai.yaml if you need to override the default configuration.
How do I configure OpenAI and Gemini API keys?
Add provider blocks under onetomany_ai in config/packages/onetomany_ai.yaml and set api_key to an environment variable such as OPENAI_API_KEY or GEMINI_API_KEY. The README shows api_version values of v1 for OpenAI and v1beta for Gemini. Provider blocks are optional, so omitting one means that provider is not registered with the AiClient facade.
Do I need to configure the transport http_client service?
Usually no. The bundle uses Symfony's http_client service by default, so the transport block can normally be omitted. You only need to set transport.http_client if you want to point the bundle at a different HTTP client service.
Which Symfony versions does 1tomany/php-ai-bundle support?
The README does not list supported Symfony versions or a maintenance policy. Check the package's composer.json on GitHub or Packagist for the exact Symfony and PHP constraints before installing. Also review the repository's releases and commit history to judge maintenance activity.
How do I upload a file and run a query with AiClientInterface?
Inject the AiClientInterface facade and use its files and queries resources. The README example uploads a LocalFile with Vendor::OpenAI and then calls compileAndRun with a Model and a Prompt. The response exposes error and text properties, so check both before using the generated text.
How do I handle errors from compileAndRun?
Inspect the response object's error property after compileAndRun and throw or log if it is not null. Also check that the text property is not null before returning or storing the output. The README example throws a RuntimeException for both cases.
Can I use only OpenAI or only Gemini with this bundle?
Yes. Provider blocks are optional, and if a provider block is omitted that provider is not registered with the AiClient facade. This lets you configure only the provider you actually use. You still need the corresponding API key environment variable for any provider you enable.
How do I test code that depends on AiClientInterface?
Because the bundle registers AiClientInterface as an autowired service, you can replace it with a test double in the Symfony container or mock it in unit tests. The README does not include a dedicated testing guide, so use standard Symfony service mocking practices. Keep provider calls out of unit tests and use integration tests only when you need to hit a real API.
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.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource