Which PHP AI library should you use in 2026?

There is no single best PHP AI library. The right one follows from your framework, and then from how much the library should do for you. In October 2026 the choice for most teams comes down to four packages: the official Laravel AI SDK, the community library Prism, the Symfony project's Symfony AI, and the framework-free LLPhant.

We build products on Symfony and work inside existing Laravel codebases. Over the last year we went through the same choice for our own features and client features. Our own SaaS, AI Resume Master, reached 50,000 monthly active users on PHP and the OpenAI API, and our project board transcribes voice notes, drafts task descriptions and writes daily reports through one small OpenAI service on Symfony HttpClient, with no AI library at all. That last option is often the right one, and we cover it at the end.

All versions, dates and requirements below were checked on Packagist and in each project's documentation on 26 October 2026.

The short answer:

  1. Laravel 12 or 13: use the Laravel AI SDK. It is official and stable since v1.0.
  2. Already on Prism: stay on it unless you need agents with stored conversations, approvals or failover.
  3. Symfony 7.3 or newer: use Symfony AI and pin the minor version, because it is still experimental.
  4. No framework, or Symfony older than 7.3: look at LLPhant or Neuron AI, or call the provider SDK directly.
  5. Plain calls to one provider: you may not need a library at all.

How do the four libraries compare?

Laravel AI SDK Prism Symfony AI LLPhant
Package laravel/ai prism-php/prism symfony/ai-* (7 packages) theodo-group/llphant
Maintainer Laravel team Community (prism-php) Symfony project Theodo
Latest version v1.3.0 (19 Oct 2026) v0.102.0 (16 Oct 2026) v0.15.0 (23 Oct 2026) 1.0.7 (6 Oct 2026)
Stability Stable since v1.0.0 (23 Sep 2026) 0.x 0.x, marked experimental 1.x
PHP 8.3+ 8.2+ 8.2+ 8.1+
Framework Laravel 12 or 13 Laravel 12.61+ or 13.12+ Bundles need Symfony 7.3+ or 8.x; components work without them None
Monthly installs (Packagist) about 3.2 million about 0.86 million about 0.41 million (platform) about 47,000
Text providers 13, including OpenAI, Anthropic, Gemini, Azure, Bedrock, Mistral, Ollama, OpenRouter 13 built in (two of them only for audio or embeddings), including OpenAI, Anthropic, Gemini, Mistral, Ollama, OpenRouter; Bedrock as a separate package About 40 provider bridges, including OpenAI, Anthropic, Gemini, Vertex AI, Azure, Bedrock, Mistral, Ollama OpenAI, Anthropic, Gemini, Mistral, Ollama, LM Studio and OpenAI-compatible APIs
Agents and tools Agent classes, tools, human approval of tool calls Tools on any request Agent component, #[AsTool] services, security checks per tool Function calling, QuestionAnswering for RAG
Structured output Yes, JSON schema in the agent Yes, schema objects Yes, from PHP classes Not in the docs
Vector search Eloquent whereVectorSimilarTo on PostgreSQL (pgvector) and MariaDB 11.7+, plus provider vector stores Embeddings only, you store vectors yourself Store component, 24 bridges including Postgres, Redis, Qdrant, Elasticsearch 13 vector stores, including Doctrine, Redis, Qdrant, Elasticsearch
MCP Tools from MCP servers via laravel/mcp Via the separate prism-php/relay package MCP Bundle on the official mcp/sdk, server and client No
Test doubles Agent::fake(), Embeddings::fake() and assertions Prism::fake() with response fakes MockPlatformFactory, MockAgent, AiAssertionsTrait None built in

Install counts are a signal of where the ecosystem is going, not of quality. They also include CI installs, so compare them only with each other.

Laravel AI SDK: the default for Laravel apps

The Laravel AI SDK is the official answer to "how do I add AI to Laravel". The first release, v0.1.0, came out on 5 February 2026, and v1.0.0 on 23 September 2026. It requires PHP 8.3 and Laravel 12 or 13.

Its central idea is the agent class: one PHP class per assistant that holds the instructions, the conversation, the tools and the output schema. You generate it with php artisan make:agent and call it like any other service.

namespace App\Ai\Agents;

use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Contracts\HasStructuredOutput;
use Laravel\Ai\Promptable;
use Stringable;

class TicketTriage implements Agent, HasStructuredOutput
{
    use Promptable;

    public function instructions(): Stringable|string
    {
        return 'Classify the support ticket and write a one-line summary for the support team.';
    }

    public function schema(JsonSchema $schema): array
    {
        return [
            'category' => $schema->string()->required(),
            'summary' => $schema->string()->required(),
        ];
    }
}

$response = (new TicketTriage)->prompt($ticket->body);
$ticket->update(['category' => $response['category']]);

What you get beyond the call itself:

  • Conversation storage. The RemembersConversations trait stores the history in two database tables that the package migration creates, so a chat survives between requests without your own table.
  • Tool approval. A tool that implements Approvable pauses the run until a person approves the call. For tools that delete or send something, this is the feature we would otherwise build by hand.
  • Queueing and failover. ->queue() runs the prompt in a queued job. Passing provider: [Lab::OpenAI, Lab::Anthropic] switches to the second provider on a rate limit, an overloaded provider or insufficient credits, but not on an ordinary bad request.
  • Token usage on every response, including cache read, cache write and reasoning tokens. That is what you need for per-customer cost logging.
  • Fakes for tests. TicketTriage::fake() returns fixed or generated answers, and for structured agents it generates fake data that matches the schema.

The trade-off is that the SDK has opinions: agent classes, its own tables, its own streaming protocols. For a Laravel team those opinions match the framework, so we recommend it as the default for new Laravel work. If you are adding AI to a Laravel app, our Laravel AI integration guide covers the plumbing around any of these libraries: queues, streaming, logging and rate limits.

Prism: a lighter fluent API for Laravel

Prism is the older community library. It started in October 2024, is now at v0.102.0, and requires PHP 8.2 and Laravel 12.61+ or 13.12+. It is a fluent builder rather than a framework of agent classes:

use Prism\Prism\Enums\Provider;
use Prism\Prism\Facades\Prism;

$response = Prism::text()
    ->using(Provider::Anthropic, 'claude-sonnet-5')
    ->withSystemPrompt('Write a one-line summary for the support team.')
    ->withPrompt($ticket->body)
    ->asText();

echo $response->text;

Prism covers text, structured output, tools, streaming, embeddings, images, audio and moderation. Prism::fake() with TextResponseFake keeps tests offline. Tools from MCP servers need the separate prism-php/relay package.

The history matters for planning. The Laravel AI SDK was built on Prism from its first release until v0.6.0. Since v0.6.1 (21 April 2026) it has had its own provider layer and no longer requires Prism. So the two are now separate projects that solve overlapping problems, and Prism is still on 0.x, without a stable API promise.

Choose Prism when you want a thin layer you fully control per request, or when your code already uses it and works. Choose the Laravel AI SDK when you need stored conversations, tool approvals, queueing and failover without writing them yourself.

Symfony AI: the choice for Symfony 7.3 and newer

Symfony AI is the Symfony project's own set of components: Platform (one API for many providers), Agent (tool calling), Store (vector databases), Chat, and two bundles, the AI Bundle and the MCP Bundle. The first tagged release was in December 2025, and the latest is v0.15.0 from 23 October 2026. The components need PHP 8.2, the bundles need Symfony 7.3 or newer.

In a Symfony app most of it is configuration, and the agent arrives through dependency injection:

# config/packages/ai.yaml
ai:
  platform:
    anthropic:
      api_key: '%env(ANTHROPIC_API_KEY)%'
  agent:
    triage:
      platform: 'ai.platform.anthropic'
      model: 'claude-sonnet-5'
      prompt:
        text: 'Write a one-line summary of the support ticket for the support team.'
use Symfony\AI\Agent\AgentInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

final class TicketTriage
{
    public function __construct(
        #[Autowire(service: 'ai.agent.triage')] private AgentInterface $agent,
    ) {}

    public function summarize(string $body): string
    {
        return (string) $this->agent->call($body)->getContent();
    }
}

Its strengths are breadth and fit: about 40 provider bridges, 24 vector store bridges, tools as ordinary services with #[AsTool], permission checks on tools through Symfony Security, and an MCP Bundle that turns your app into an MCP server for Claude or ChatGPT.

Its weakness is stability. Every package is marked experimental, and minor versions do break things. In October 2026 alone, v0.15.0 removed the InMemoryPlatform test double and changed the default pgvector index from ivfflat to hnsw, and the upgrade notes for 0.16 already change how the agent treats your message history. Pin ^0.15, read UPGRADE.md before each bump and keep your own interface between business code and the agent. Our Symfony AI production guide covers cost logging, retries and tests in detail.

If your app is still on Symfony 6.4, the bundles will not install. You can upgrade first (our Symfony 6.4 to 7.4 guide has the steps; we moved this site to 7.4 LTS and PHP 8.5 in October 2026), or use the stable HttpClient and Messenger approach until you do.

LLPhant and Neuron AI: framework-free options

LLPhant has been around since July 2023 and is at 1.0.7. It requires PHP 8.1, works in Symfony, Laravel or plain PHP, and is maintained under the Theodo organization. It is built around RAG: embedding generators, 13 vector stores (including a Doctrine store for PostgreSQL), and a QuestionAnswering class that ties retrieval and the chat model together.

use LLPhant\Chat\AnthropicChat;
use LLPhant\Query\SemanticSearch\QuestionAnswering;

$qa = new QuestionAnswering($vectorStore, $embeddingGenerator, new AnthropicChat());
$answer = $qa->answerQuestion('What is our refund policy for annual plans?');

Its usage is far smaller than the others (about 47,000 installs a month), it has no test doubles of its own, and it uses openai-php/client under the hood for OpenAI. It is a reasonable choice for a framework-free service or a Symfony app older than 7.3 that needs RAG.

Neuron AI (neuron-core/neuron-ai, v4.1.14, PHP 8.1) is another framework-free option, focused on agents and multi-step workflows with human-in-the-loop, MCP connectors and integrations for both Laravel and Symfony. With about 200,000 installs a month it is larger than LLPhant. We have not compared it in depth here because most teams we talk to choose between the first four.

When do you not need an AI library at all?

When all your features use one provider and plain calls, with no agents looping over tools and no vector store, a library adds more than it removes. A service class on top of Symfony HttpClient or Laravel's HTTP client, or the official SDKs (openai-php/client, about 2.8 million installs a month, and Anthropic's anthropic-ai/sdk, v1.3.0), gives you:

  • one place that holds the prompt, the model name from config and the token logging;
  • tests with a mocked HTTP client and no extra fake layer;
  • no 0.x dependency to upgrade every month.

That is how our project board runs its five OpenAI features today, from voice transcription to daily reports. We would move it to Symfony AI only when it needs a second provider, several tools or a vector store.

Which library do we recommend?

Your situation Our pick
New Laravel feature, Laravel 12 or 13 Laravel AI SDK
Laravel app that already uses Prism and works Keep Prism, revisit when you need stored conversations or approvals
Symfony 7.3+ app, several providers, agents or RAG Symfony AI, minor version pinned
Symfony 6.4 app Upgrade to 7.4 LTS, or HttpClient now and Symfony AI after the upgrade
Framework-free PHP service doing RAG LLPhant, or Neuron AI for multi-step agents
Plain calls to one provider, no agents or vector store HTTP client or official SDK behind your own service
Expose your app to Claude or ChatGPT as tools Symfony MCP Bundle or laravel/mcp, see our PHP MCP server guide

Whatever you choose, the library is the smallest part of the work. The parts that decide whether the feature survives production are the same in every stack: an evaluation set of 50 to 200 real inputs, token and cost logging per customer, rate limits per user, and background processing for anything slower than a few seconds. Before you pick a model, our LLM API cost calculator shows what a feature will cost per month at your volume.

Next step

If you want a senior PHP team to add an OpenAI, Claude or Gemini feature to your Laravel or Symfony product, see our AI integration services. Most first features take 4 to 8 weeks and start from $10,000, with a fixed quote after a short scoping call. Contact us with a description of the feature and the data it needs.

Case studies

Frequently asked questions

The Laravel AI SDK (laravel/ai) is the official package from the Laravel team, built around agent classes with conversation storage in the database, tools with human approval, queueing, failover between providers and fakes for tests. Prism (prism-php/prism) is a community package with a fluent API for text, structured output, tools, embeddings, images and audio. Early Laravel AI SDK versions ran on Prism; since v0.6.1 (April 2026) the SDK no longer depends on it.

Yes. The Laravel AI SDK reached v1.0.0 on 23 September 2026, and the latest release as of October 2026 is v1.3.0 (19 October 2026). It requires PHP 8.3 or newer and Laravel 12 or 13. Prism is still on 0.x (v0.102.0) and Symfony AI is on 0.x (v0.15.0) and marked experimental, so those two can change their APIs between minor versions.

Not in practice. The Laravel AI SDK requires several illuminate packages (container, database, console, support), and Prism requires laravel/framework. In a Symfony app use Symfony AI, LLPhant, Neuron AI, or the official provider SDKs such as openai-php/client and anthropic-ai/sdk behind your own service.

For RAG over PostgreSQL with pgvector, all three main options work: Laravel has a whereVectorSimilarTo query on Eloquent for PostgreSQL and MariaDB 11.7+ that the AI SDK documents for embeddings, Symfony AI has a Store component with 24 vector store bridges including Postgres, and LLPhant has a QuestionAnswering class and 13 vector stores including a Doctrine one. The library matters less than chunking, filters per tenant and an evaluation set.

No. For plain calls to a single provider, a small service class on top of Symfony HttpClient, Laravel's HTTP client or the official SDK is easier to test and has no extra dependency. Our own project board runs five OpenAI features that way. A library pays off when you need several providers, agents with many tools, a vector store abstraction or an MCP integration.

With us, a first AI feature in an existing Laravel or Symfony product starts from $10,000 and usually takes 4 to 8 weeks, with a fixed quote after a short scoping call. A focused first feature can run as one AI Sprint: $10,000 fixed for 4 weeks. Model API usage is billed by the provider directly.

Let’s start your project
Book a call