# LLPhant - The PHP library for Gen AI and Vector Databases

<div align="center">
    <img src="docs/assets/llphant-logo.png" alt="LLPhant" style="border-radius: 50%; padding-bottom: 20px"/>
</div>

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](https://openai.com/blog/openai-api), [Anthropic](https://www.anthropic.com/), [Mistral](https://mistral.ai/), [Ollama](https://ollama.ai/), [LM Studio](https://lmstudio.ai/), [Atlas Cloud](https://www.atlascloud.ai/docs) and services compatible with the OpenAI API such as [LocalAI](https://localai.io/).
Ollama that can be used to run LLM locally such as [Llama 2](https://llama.meta.com/).

## Atlas Cloud

LLPhant's `AtlasCloudConfig` targets the OpenAI-compatible Atlas Cloud endpoint
at `https://api.atlascloud.ai/v1` and now defaults to the validated chat model
`qwen/qwen3.5-flash`.

The configuration also accepts any Atlas model slug exposed by your account via
the optional `ATLASCLOUD_MODEL` environment variable. Examples from the current
public Text model list include:

- `qwen/qwen3.5-flash`
- `qwen/qwen3.6-plus`
- `deepseek-ai/deepseek-v4-flash`
- `deepseek-ai/deepseek-v4-pro`
- `google/gemini-3.5-flash`
- `zai-org/glm-4.7`

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

-   the learnings from using [LangChain](https://www.langchain.com/) and [LLamaIndex](https://www.llamaindex.ai/)
-   the excellent work from the [OpenAI PHP SDK](https://github.com/openai-php/client).

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

-   🇫🇷 [Construire un RAG en PHP avec la doc de Symfony, LLPhant et OpenAI : Tutoriel Complet](https://www.youtube.com/watch?v=zFJgRd05Noo)
-   🇫🇷 [Retour d'expérience sur la création d'un agent autonome](https://www.youtube.com/watch?v=ZnYUxTtS6IU)
-   🇬🇧 [Exploring AI riding an LLPhant](https://www.slideshare.net/slideshow/exploring-ai-riding-an-llphant-an-open-source-library-to-use-llms-and-vector-dbs-in-php/272059145)
-   🇬🇧 [Evaluating LLM and AI agents Outputs with String Comparison, Criteria & Trajectory Approaches](https://medium.com/towards-artificial-intelligence/evaluating-large-language-model-outputs-with-string-comparison-criteria-trajectory-approaches-c42d43c0cdc3)

# Get Started

> **Note**  
> **Requires** [PHP 8.1+](https://php.net/releases/)

First, install LLPhant via the [Composer](https://getcomposer.org/) package manager:

```bash
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

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

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

```bash
composer require theodo-group/llphant:dev-main
```

You may also want to check the requirements for [OpenAI PHP SDK](https://github.com/openai-php/client) as it is the main client.

## Documentation

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

## Contributing

See [CONTRIBUTING](CONTRIBUTING.md) for details.

## Contributors

Thanks to our contributors:

<a href="https://github.com/theodo-group/llphant/graphs/contributors">
<img src="https://contrib.rocks/image?repo=theodo-group/llphant" />
</a>

## Sponsor

LLPhant is sponsored by :

-   [AGO](https://useago.com). Generative AI customer support solutions.
-   [Theodo](https://www.theodo.fr/) a leading digital agency building web application with Generative AI.

<div align="center">
  <a href="https://www.theodo.fr/" />
    <img alt="Theodo logo" src="https://cdn2.hubspot.net/hub/2383597/hubfs/Website/Logos/Logo_Theodo_cropped.svg" width="200"/>
  </a>
</div>
