LLPhant is a free, open source machine learning infrastructure project written in PHP and released under MIT. It has 1,722 GitHub stars, 179 forks and 36 open issues, and was last pushed 20 hours ago. On this registry it ranks #59 of 89 tracked projects in Machine Learning Infrastructure, with 5 head-to-head comparisons available. It gained 11 stars over the last 30 tracked days.

What is LLPhant?

LLPhant is an MIT-licensed PHP framework for building generative AI and vector-database applications, aimed at PHP developers working in Symfony or Laravel who want LangChain-style tooling without leaving their language.

What it is

LLPhant is a PHP library, installed through Composer as theodo-group/llphant, that gives PHP applications a single interface for generative AI workloads: chat completions, embeddings, agents, and vector-database retrieval. It is designed to stay simple while still offering the tools needed to build substantial applications, and it is compatible with both Symfony and Laravel. The project is maintained under the MIT licence and currently records 1,708 stars, 172 forks, and 36 open issues on GitHub.

The concrete problem it solves is language. LangChain and LlamaIndex, which the project credits as influences, are Python-first, so PHP teams building on Symfony or Laravel had no native path to the same patterns. LLPhant fills that gap for the PHP ecosystem and sits on top of the OpenAI PHP SDK, which acts as its main client. It also covers vector databases, the second half of the retrieval-augmented generation stack, so a PHP service can embed, store, retrieve, and prompt without shelling out to a separate Python process.

Key capabilities

  • Provider abstraction across OpenAI, Anthropic, Mistral, Ollama, llmman, LM Studio, and Atlas Cloud, plus any service compatible with the OpenAI API such as LocalAI.
  • Local model execution through Ollama, which can run models such as Llama 2 on your own hardware.
  • Vector-database support, named in the project's own description of itself as the PHP library for Gen AI and vector databases.
  • Embeddings, exposed as a first-class topic alongside agents and generative AI.
  • Agent construction, for autonomous and multi-step workloads.
  • Framework integration for Symfony and Laravel, with the library usable from either without an adapter layer.
  • Composer-based distribution, with a dev-main channel for pre-release features.

Who uses it and how

  • PHP teams on Symfony or Laravel that want retrieval-augmented generation inside an existing application rather than a separate service.
  • Developers running models locally through Ollama or LM Studio, avoiding per-token API costs and keeping prompts on their own infrastructure.
  • Teams building autonomous agents, a workflow documented in a French-language write-up on creating an autonomous agent.
  • Engineers mapping a Symfony documentation set into a RAG pipeline with OpenAI, covered in a French-language tutorial.
  • Teams evaluating model and agent output using string comparison, criteria, and trajectory approaches, as described in a Medium article.
  • Projects backed by agencies using the stack commercially; LLPhant is sponsored by AGO and Theodo.

Getting started

Install with composer require theodo-group/llphant on PHP 8.1 or later; add --ignore-platform-req=ext-gd if the GD extension is not installed, or use composer require theodo-group/llphant:dev-main for the latest features. Documentation lives in the docs directory and at llphant.readthedocs.org.

How it compares

The facts name no paid products that LLPhant replaces. It fits instead alongside LangChain and LlamaIndex, the two projects it credits as inspirations and whose patterns it ports to PHP, and on top of the OpenAI PHP SDK, which it uses as its primary client. Where LangChain and LlamaIndex serve Python codebases, LLPhant serves PHP ones, so the choice between them is a choice of runtime rather than of feature set.

When to use it — and when not to

A self-hoster must provide a PHP 8.1 or newer runtime with Composer, optionally the GD extension, plus either API credentials for OpenAI, Anthropic, Mistral, or Atlas Cloud, or a locally running Ollama or LM Studio instance, and a vector store if retrieval is required. Teams without PHP in production should not adopt it, since its entire value is fitting generative AI into that ecosystem; Python shops already served by LangChain or LlamaIndex gain nothing here. Note that the README is brief and does not enumerate which vector databases are supported, so verify your specific store against the docs directory and llphant.readthedocs.org before committing.

project readme (upstream, from github) — read inline

LLPhant - The PHP library for Gen AI and Vector Databases

We designed this framework to be as simple as possible, while still providing you with the tools you need to build powerful apps. It is compatible with Symfony and Laravel.

We are working to expand the support of different LLMs. Right now, we are supporting OpenAI, Anthropic, Mistral, Ollama, llmman, LM Studio, Atlas Cloud and services compatible with the OpenAI API such as LocalAI. Ollama that can be used to run LLM locally such as Llama 2.

We want to thank few amazing projects that we use here or inspired us:

We can find great external resource on LLPhant (ping us to add yours):

Get Started

Note
Requires PHP 8.1+

First, install LLPhant via the Composer package manager:

composer require theodo-group/llphant

In case you have not installed the GD extension, and you do not want to add it to your PHP setup, you can use the --ignore-platform-req=ext-gd option

composer require theodo-group/llphant --ignore-platform-req=ext-gd

If you want to try the latest features of this library, you can use:

composer require theodo-group/llphant:dev-main

You may also want to check the requirements for OpenAI PHP SDK as it is the main client.

Documentation

Find documentation in the docs directory or online at https://llphant.readthedocs.org

Contributing

See CONTRIBUTING for details.

Contributors

Thanks to our contributors:

Sponsor

LLPhant is sponsored by :

  • AGO. Generative AI customer support solutions.
  • Theodo a leading digital agency building web application with Generative AI.
Theodo logo

Frequently asked questions

Is LLPhant free to use?

LLPhant is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does LLPhant do?

LLPhant - A comprehensive PHP Generative AI Framework using OpenAI GPT 4. Inspired by Langchain

What is LLPhant written in?

LLPhant is primarily written in PHP. Its source is publicly available at https://github.com/LLPhant/LLPhant, and it has 1,722 GitHub stars.