llmesh / core
LLMesh Core - A flexible PHP SDK for interacting with multiple LLM providers
Fund package maintenance!
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- psr/event-dispatcher: ^1.0
- psr/http-client: ^1.0
- psr/log: ^3.0
Requires (Dev)
- mockery/mockery: ^1.6
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.7
Suggests
- ext-pdo: Required if using DatabaseStore for memory storage or PgVectorStore for vector storage
- ext-pdo_pgsql: Required if using PostgreSQL/pgvector for vector storage
- ext-redis: Required to use RedisStore for memory storage
- predis/predis: Alternative Redis client library for RedisStore
This package is auto-updated.
Last update: 2026-06-06 21:01:12 UTC
README
LLMesh is a flexible PHP SDK designed to help developers build AI-powered applications and autonomous agents.
Why use LLMesh?
Integrating large language models (LLMs) into applications is complicated and heavily dependent on the specific model provider you use.
LLMesh standardizes integrating artificial intelligence (AI) models across supported providers. This enables developers to focus on building great AI applications, not waste time on technical details.
For example, here’s how you can generate text with various models using LLMesh:
use LLMesh\Core\LLMesh; use LLMesh\Core\Generators\GenerateTextOptions; use LLMesh\OpenAI\OpenAIProvider; $response = LLMesh::generateText( new OpenAIProvider($apiKey), GenerateTextOptions::make()->withPrompt('What is love?') ); echo $response->getText();
Installation
Install the core library along with a provider (e.g. OpenAI):
composer require llmesh/core llmesh/openai
Decoupled Packages
The LLMesh ecosystem consists of separate, modular packages:
- LLMesh Core: The unified interfaces, memory builder, RAG pipeline, and orchestration loop.
- OpenAI Provider: Provider adapter for OpenAI models.
- Anthropic Provider: Provider adapter for Anthropic Claude models.
- Laravel Adapter: First-class integration for Laravel applications.
Features
- generateText: Unified API for text generation with full parameter customization.
- streamText: Real-time chunked text generation and Server-Sent Events (SSE) responses.
- generateObject: Type-safe JSON output validated against custom schemas.
- tools: Native function/tool calling with parameter mapping and validation.
- agents: Autonomous multi-step orchestration loop with tool execution.
- memory: Pluggable conversation memory stores (In-Memory, Redis, Database).
- RAG: End-to-end ingestion pipeline (load, split, embed, store, retrieve).
Contributing
Please see the CONTRIBUTING.md guide for information on local setup, extending LLMesh with custom providers or vector stores, and the pull request checklist.
License
The MIT License (MIT). Please see LICENSE for details.