Download the PHP package synapcores/sdk without Composer
On this page you can find all versions of the php package synapcores/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download synapcores/sdk
More information about synapcores/sdk
Files in synapcores/sdk
Package sdk
Short Description Official PHP SDK for SynapCores AIDB — SQL, vectors, RAG, and agentic runtime from any PHP project
License MIT
Homepage https://synapcores.com
Informations about the package sdk
synapcores/sdk — PHP SDK for SynapCores AIDB
Official PHP SDK for SynapCores — the AI-native database that runs SQL, vectors, RAG, and the in-database agentic runtime from a single engine.
Framework-agnostic. Use it from vanilla PHP, Symfony, WordPress, or any Composer-managed project. For a Laravel-native experience (facade, artisan commands, Eloquent vector cast, queue jobs), see synapcores/laravel.
Requirements
- PHP 8.1+
ext-json- A running SynapCores engine (free CE:
docker pull synapcores/community:latest)
Install
Quickstart — 30 seconds
What's in the box
| Method | What it does |
|---|---|
sql(string $sql, array $params = []) |
Run SQL via /v1/query/execute. :name placeholders are substituted client-side with proper SQL escaping (the engine's REST surface doesn't parse placeholders). Returns QueryResult. |
embed(string $text, ?string $model = null) |
SELECT EMBED(...) — returns float[]. |
ragSearch(string $query, array $opts = []) |
Top-K similar rows from a table with a VECTOR column. |
agentRun(string $persona, string $task, array $opts = []) |
Fire AGENT_RUN() — in-DB agentic runtime. Returns AgentRunResult. |
importRecipe(string $url) |
Import a recipe from a URL. |
execRecipe(string $recipeId, array $params = []) |
Execute an imported recipe. |
knnSearch(string $table, array $vec, int $k = 10, array $opts = []) |
KNN against a VECTOR column with a literal query vector. |
login(?string $u, ?string $p) |
Exchange credentials for a JWT (only needed without API key). |
Every error becomes a SynapCores\SDK\Exception\… — AuthException, QueryException, NetworkException, EnvelopeException. Catch SynapCoresException to catch them all.
Examples
RAG over your docs
In-DB agent
Import + run a recipe
Embedding generation
Configuration reference
| Key | Type | Default | Notes |
|---|---|---|---|
host |
string | localhost |
Gateway hostname |
port |
int | 28080 |
Gateway port |
useHttps |
bool | false |
Set true in prod |
apiKey |
string | — | aidb_… Bearer key (recommended) |
token |
string | — | Pre-obtained JWT (skip login()) |
username |
string | — | For the login() flow |
password |
string | — | For the login() flow |
timeout |
float | 30.0 |
Request timeout in seconds |
database |
string | — | Sets X-Database header |
tenant |
string | — | Sets X-Tenant header |
userAgent |
string | synapcores-php-sdk/1.0.0 |
|
verifyTls |
bool | true |
Set false ONLY for local self-signed dev |
Parameter binding — how it actually works
The engine's /v1/query/execute route does NOT parse :name, ?, or $1
placeholders server-side. The SDK substitutes :name placeholders
client-side with proper SQL escaping (single-quote doubling, backslash
escape, NULL/TRUE/FALSE literals, vector array literals for float[]).
What goes over the wire is fully inlined SQL — you'll never see a params
field in the request body. This means:
array<string, scalar|null|float[]>is the only supported$paramsshape.- Untrusted user input is safe IF it's passed through
$params(the SDK escapes it). Never string-concatenate user input into the SQL itself. - If a
:namein the SQL has no matching key, the SDK throwsQueryException— fail-fast, not silent.
Engine compatibility
Tested live against SynapCores AIDB v1.7.0.2.1-ce (current :latest,
image ghcr.io/synapcores/community:latest). The SDK targets the stable
/v1/* REST surface — minor engine releases should not break it.
License
MIT — see LICENSE.