Download the PHP package fluffydiscord/honkers-sdk without Composer
On this page you can find all versions of the php package fluffydiscord/honkers-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fluffydiscord/honkers-sdk
More information about fluffydiscord/honkers-sdk
Files in fluffydiscord/honkers-sdk
Package honkers-sdk
Short Description Framework-agnostic chatbot tool-server core: tools, data sources, JSON-schema generation and result DTOs
License proprietary
Informations about the package honkers-sdk
honkers.dev SDK
Framework-agnostic PHP for the honkers.dev chatbot. Serve the tool/source endpoints the chatbot calls, push catalog changes back to the backend, and render the chat widget — no framework required.
Used by:
fluffydiscord/symfony-honkers-bundle— Symfony wiring + the/chatbot/v1HTTP endpoints.fluffydiscord/sylius-honkers-bundle— Sylius defaults (tools, data sources, shop widget).
Examples
A tool — one class, one arguments DTO:
Argument DTOs carry symfony/validator constraints; ArgumentsSchemaGenerator turns them into a
JSON Schema (with runtime-loaded choice enums):
Registries wrap a plain iterable of tools/sources and key them by getDefinition()->name:
Names must be unique — on a duplicate, get() returns the first match. The Symfony bundle fails
the container build on a duplicate; standalone, keep them distinct yourself.
Also here: ChatbotDataSourceInterface (bulk documents), ToolChoiceLoaderInterface +
#[ToolChoice] (DB-backed enums), the ChatbotLocaleContextInterface port the host app implements,
result DTOs (ToolResult, ToolDefinition, SourceDocument, …) and helpers (CursorCodec,
LocaleMatcher, HtmlToText).
Standalone setup (no framework)
The SDK owns the logic, not the transport. You wire the registries once, then map four HTTP routes to them.
Wire the pieces — each registry takes a plain list of services, no container:
GET /chatbot/v1/tools — tool list with input schemas:
POST /chatbot/v1/tools/{name} — body { "arguments": {...}, "context": {...} }:
GET /chatbot/v1/sources and GET /chatbot/v1/sources/{name}:
You provide, around the SDK: auth, routing, and argument deserialization. Locale
matching against a channel's served locales is optional — use LocaleMatcher and implement
ChatbotLocaleContextInterface if you have channels.
HTTP contract (what the chatbot backend expects)
The paths are fixed: the backend calls /chatbot/v1/... on your host. Serve the endpoints at exactly
these paths — only the origin (scheme + host) is yours to configure on the backend.
| Method | Path | Request | Response |
|---|---|---|---|
| GET | /chatbot/v1/tools |
Accept-Language (optional) |
{ "tools": [ {name, description, inputSchema, ui?} ] } |
| POST | /chatbot/v1/tools/{name} |
{ "arguments": {...}, "context": { "conversationId", "locale", "channelCode"? } } |
{ "content": [{type,text}], "blocks": [], "isError": bool } |
| GET | /chatbot/v1/sources |
— | { "sources": [ {name, description, locales} ] } |
| GET | /chatbot/v1/sources/{name} |
?locale=&channel=&cursor=&ids[]= (ids[] max 500; then cursor ignored, nextCursor null) |
{ "documents": [...], "nextCursor": string\|null } |
- Auth — the backend sends
Authorization: Bearer <shared-secret>. The SDK does no auth; verify the header yourself (hash_equals) or let the Symfony bundle's firewall do it. - Errors — every failure returns
{ "error": { "code", "message", "violations" } }. Throw aChatbotApiExceptionsubclass;getErrorCode()gives thecode,getStatusCode()the HTTP status (tool_not_found/source_not_found404,validation_failed422 withviolations,invalid_cursor/invalid_locale400).
Outbound: push catalog changes
Tell the backend which catalog entries changed so it re-indexes them. This is the only call your
server makes to honkers.dev — POST {backend}/api/v1/catalog/changes, auth Bearer {siteKey}.{ingestSecret}.
The client speaks PSR-18, so plug in any HTTP client (Guzzle, Symfony's Psr18Client, …) and PSR-17
factories:
sourceisproducts,categories, orcms_pages(CatalogSourceName).- Max 500 ids per call. More than that throws — chunk them yourself.
202→accepted, with a per-id job list (bad ids come backrejectedwith aviolation).429→isThrottled(),retryAfterSecondsset; nothing was queued.- Auth/validation failures throw
CatalogIngestException(getStatusCode(),getBackendErrorCode()).
Widget embed
Render the chat widget markup for any page:
Emits a deferred loader <script> and the <ai-chat-widget> element; all attribute values are escaped.
Tests
All versions of honkers-sdk with dependencies
ext-intl Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
symfony/intl Version ^6.4 || ^7.0 || ^8.0
symfony/validator Version ^6.4 || ^7.0 || ^8.0