Download the PHP package johannes85/ai-bundle without Composer

On this page you can find all versions of the php package johannes85/ai-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ai-bundle

Symfony AI Bundle

example workflow

This PHP Symfony bundle allows to call LLM backends like OpenAI, Ollama etc. in a generic and simple way.

It also provides an MCP client and server with tool calling capabilities. This allows you to easily expose your Symfony services as MCP tools or call MCP tools provided by an MCP server.

The following backends are supported:

Backend Text generation Image processing Tool calling MCP Tool calling Info
OpenAI ✅ ✅ ✅ ✅ https://openai.com/
Ollama ✅ ✅ ✅*1 ✅ https://ollama.ai/
GoogleAI ✅ ✅ ✅ ✅ https://ai.google.dev
Anthropic ✅ ✅ ✅ ✅ https://www.anthropic.com/
Mistral AI ✅ ✅ ✅ ✅ https://mistral.ai/
DeepSeek ✅ ❌ ✅ ✅ https://www.deepseek.com/

The OpenAI endpoint URL can be changed so it is possible to access different backends with an OpenAI compatible API. But be aware that not all features are supported by all backends.
=> Feedack regarding the compatibility of the different backends is welcome.

Requirements

Features

Backend independent generating:

Image processing:

Persistent message history:

See example:

The following store backends are supported:

Support for structured responses with deserialization in an object instance:

More information about how to define the schema of the response data type can be found in the Schema Generator documentation.

Tool calling support

More information about how to define the schema of the tool callback function be found in the Schema Generator documentation.

MCP tool calling

Calling tools provided by an MCP server via the stdio and Streamable HTTP transport is supported.

See the MCP Client documentation for more information.

MCP server

The MCP server allows to expose service methods as MCP tools via Streamable HTTP transport. It can be used to create a custom MCP server that can be called by LLMs or other clients.

See the MCP Server documentation for more information.

Usage

Configure LLM backend instances

To use a specific backend as a service, it has to be registered in the bundle config:

In this example, the following services will be registered:

When configuring the "default" instance of a llm, in addition to the ID, the class itself (e.g. AiBundle\LLM\OpenAi\OpenAi) will be registered as a service.

Execute standalone examples

This bundle provides standalone examples of the features provided. They can be executed by a central console command similar to the Symfony console:

You can get a list of available examples by executing:

The llm backend to use can be set via the option. The following values are supported:

Before using the examples, you have to set the api key for the corresponding backend as an environment variable:


All versions of ai-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/serializer Version ^7.0
symfony/property-info Version ^7.0
symfony/http-client Version ^7.0
phpdocumentor/reflection-docblock Version ^5.2
symfony/property-access Version ^7.0
symfony/uid Version ^7.0
symfony/process Version ^7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package johannes85/ai-bundle contains the following files

Loading the files please wait ...