Download the PHP package jarir-ahmed/php-llm without Composer
On this page you can find all versions of the php package jarir-ahmed/php-llm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jarir-ahmed/php-llm
More information about jarir-ahmed/php-llm
Files in jarir-ahmed/php-llm
Package php-llm
Short Description Framework-agnostic unified AI/LLM toolkit for PHP — LLMs, embeddings, vector databases, RAG, agents, memory, cost tracking and structured output. Merges and extends manik/neuro + manik/cortex with zero framework coupling.
License MIT
Informations about the package php-llm
jarir-ahmed/php-llm
A framework-agnostic unified AI/LLM toolkit for PHP — one fluent API over many LLM, embedding and vector-database providers, plus RAG, agents, memory, cost/token tracking and structured output.
This package merges and extends
manik/neuroandmanik/cortex(which are the same Laravel package under two names) into a single library with zero framework coupling — nolaravel/frameworkdependency. Works in Laravel, Symfony, WordPress, Slim, or plain PHP.
What changed vs. neuro/cortex
| Area | neuro / cortex | php-llm |
|---|---|---|
| Framework | Requires laravel/framework |
None — pure PHP + Guzzle |
| Bootstrap | ServiceProvider + Facade | Client::create() factory |
| HTTP | Illuminate\Support\Facades\Http |
Guzzle-backed Support\Http (same fluent API) + retry + true SSE streaming |
| Config | Laravel config() |
Support\Config (dot-access, env fallback) |
| DB (memory/pgvector) | Illuminate\...\DB |
raw PDO with self-healing tables |
| Session memory | Laravel session | SessionStore ($_SESSION / in-memory / pluggable) |
| Cost tracking | flags only | Pricing + Usage: real USD estimates per call |
| Structured output | — | JSON-schema ->structured() (native or instruct+parse) |
| Providers | 7 LLMs | + DeepSeek, Groq, Azure OpenAI, OpenRouter |
| Fluent client | shared, stateful builder | fresh Generation per call + ask(), conversation() |
Install
Requires PHP 8.3+. ext-pdo is only needed for the persistent-memory and pgvector drivers.
Quick start
Any value you don't override falls back to the packaged defaults, which read from environment variables (e.g. OPENAI_API_KEY). So in production you can often just do Client::create().
LLM providers
| Provider | Key | Notes |
|---|---|---|
| OpenAI | openai |
|
| Anthropic | anthropic |
|
| Google Gemini | gemini |
|
| Ollama | ollama |
local, no key |
| xAI Grok | grok |
|
| Mistral | mistral |
|
| Cohere | cohere |
|
| DeepSeek | deepseek |
new |
| Groq | groq |
new |
| Azure OpenAI | azure |
new — set base_url (endpoint) + deployment |
| OpenRouter | openrouter |
new — optional referer/title headers |
Cost & token tracking
Every chat() result carries normalized usage and an estimated cost (USD). Prices live in Pricing and are overridable:
Hook every call for logging/metering:
Structured output (JSON)
Uses native response_format JSON-schema on OpenAI-compatible providers, and an instruction + tolerant parser everywhere else.
Streaming
OpenAI-family drivers stream true Server-Sent Events token-by-token via the Guzzle stream body.
Conversations with memory
Memory drivers: session (web), conversation (in-process), persistent (PDO, self-creating table).
Embeddings, vectors & RAG
Vector drivers: qdrant, pinecone, pgvector (PDO), weaviate, milvus, chroma.
Agents & tool calling
Using inside a framework
Nothing framework-specific is required. In Laravel/Symfony just build the client once in a service/container binding:
You can also plug your framework's session and DB in: SessionStore::use($yourStore) and Client::useDatabase('default', $pdo).
Testing without network
For driver-level tests, inject a Guzzle mock: PendingRequest::useClient($guzzleWithMockHandler).
Architecture
Credits
Built on the excellent work of Manik Mia (manik/neuro, manik/cortex). This package re-architects that code to be framework-agnostic and adds cost tracking, structured output, extra providers, and a polished fluent client.
License
MIT.
All versions of php-llm with dependencies
guzzlehttp/guzzle Version ^7.5
psr/http-message Version ^1.1 || ^2.0
ext-json Version *