Download the PHP package bootdesk/chat-sdk-core without Composer
On this page you can find all versions of the php package bootdesk/chat-sdk-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bootdesk/chat-sdk-core
More information about bootdesk/chat-sdk-core
Files in bootdesk/chat-sdk-core
Package chat-sdk-core
Short Description Core package for the PHP Chat SDK
License MIT
Informations about the package chat-sdk-core
bootdesk/chat-sdk-core
Framework-agnostic core SDK for building chat bots in PHP.
Installation
Chat class
The main entry point. Accepts a state adapter, adapters, configuration, and optional ConcurrencyHandler.
Thread
Represents a conversation thread on any platform. Retrieved by platform-specific identifier.
Cards
Build rich, platform-adaptive message cards with text, tables, dividers, links, buttons, and more.
Element types
| Builder method | Type | Description |
|---|---|---|
header(string) |
— | Card title (rendered as bold header) |
section(callable) |
Section |
Grouped text + fields |
text(string, TextStyle) |
Text |
Styled text (Bold, Muted, Plain) |
divider() |
Divider |
Horizontal separator (---) |
link(label, url) |
Link |
Inline hyperlink |
table(headers, rows, align) |
Table |
Data table with optional column alignment |
image(url, alt) |
Image |
Embedded image |
actions(Button[]) |
Button |
Action buttons (triggers onAction) |
linkButton(label, url, style) |
LinkButton |
URL button (opens link) |
Text styles
Buttons
Table with alignment
Full example
Card imageUrl
Set a header image that renders as a native image block on supported platforms:
- Slack: renders as a
type: imageBlock Kit block before the header - Telegram: uses
sendPhotowith the card text as caption - Discord: renders as
embed.image.url
Sections with fields
Platform rendering
Each adapter converts cards to its native format:
| Adapter | Format |
|---|---|
| Slack | Block Kit (header, section, divider, image, actions) |
| Discord | Embed + Action Row components |
| Telegram | HTML text + inline keyboard |
| Interactive reply buttons or text fallback | |
| Messenger | Generic/Button template |
| GitHub | Markdown (headings, pipe tables, links) |
| Linear | Markdown (same as GitHub) |
Attachments & File Uploads
Send URL-based media attachments or binary file uploads with any message.
URL-based Attachments
All adapters support URL-based attachments. Platforms without native attachment rendering fall back to text links.
Binary File Uploads
Native support: Slack (3-step API), Telegram (sendDocument), Discord (files[N] multipart).
Other platforms: Binary files are converted to URL-based attachments via a FileUploadConverter. If no converter is registered, AdapterException is thrown.
FileUploadConverter
In Laravel, bind it in your service provider:
Conversations
Define multi-turn dialog flows by extending the Conversation class.
Start a conversation:
Middleware
Three middleware interfaces for intercepting different stages:
- ReceivingMiddleware -- Intercept inbound messages before handlers run
- SendingMiddleware -- Intercept outbound messages before they are delivered
- WebhookMiddleware -- Intercept raw webhook payloads before parsing
Extending Adapters
All adapters use protected members for extensibility. Extend any adapter to customize behavior:
Register your custom adapter via AdapterRegistry:
With AdapterResolver: Dynamic resolution tries resolver first (tenant-specific), then falls back to static adapters from config (global default). This allows tenants to override specific adapters while using global defaults for others.
StateAdapter interface
The state adapter handles persistence, pub/sub, locking, and queuing. Methods:
| Method | Purpose |
|---|---|
connect |
Establish connection to state store |
disconnect |
Close connection |
subscribe |
Subscribe to a channel |
unsubscribe |
Unsubscribe from a channel |
acquireLock |
Acquire a named lock with TTL (returns Lock or null) |
releaseLock |
Release a previously acquired lock |
extendLock |
Extend a lock's TTL (returns bool) |
get |
Retrieve a value by key |
set |
Store a value by key with optional TTL |
delete |
Remove a value by key |
enqueue |
Add item to a queue (max size configurable) |
dequeue |
Remove and return item from a queue |
queueDepth |
Get current queue size |
Locks are used for concurrency control (drop/queue/debounce strategies). Queues store pending messages when concurrency: queue is set.
Concurrency is pluggable via ConcurrencyHandler. The core provides DefaultConcurrencyHandler (sync/blocking with usleep for debounce). Framework packages (e.g., Laravel) replace it with async implementations that dispatch jobs to workers. ConcurrencyHandler::process() accepts an optional ?ServerRequestInterface $request — framework packages can serialize it for jobs so AdapterResolver receives the original request in queued context. Adapters can declare sync/async preference via RequiresSyncResponse and RequiresAsyncResponse marker interfaces.
MessageContext
Passed to every event handler.
- Properties:
thread,message,transcripts - Methods:
skip(),setState(),getState()
Event handlers
| Method | Pattern | Description |
|---|---|---|
onNewMessage |
regex | Match text messages |
onDirectMessage |
- | DM-only messages |
onNewMention |
- | Bot was mentioned |
onSubscribedMessage |
- | Subscribed thread messages |
onReaction |
emoji | Reaction added/removed |
onAction |
actionId | Button/action triggered |
onSlashCommand |
command | Slash command |
onModalSubmit |
callbackId | Modal form submitted |
onModalClose |
callbackId | Modal form closed |
onOptionsLoad |
actionId | External select options requested |
onAssistantThreadStarted |
- | Slack assistant thread created |
onAssistantContextChanged |
- | Slack assistant context changed |
onAppHomeOpened |
- | Slack App Home tab opened |
onMemberJoinedChannel |
- | User joined a channel |
Modals
Build and open platform-agnostic modal forms.
Value Objects
Opening Modals from Handlers
Both ActionEvent and SlashCommandEvent expose openModal() via the OpensModals trait:
Modal context (thread info) is stored server-side and restored when the modal is submitted or closed, so handlers have access to $event->relatedThread.
External Selects / Options Load
When using ExternalSelect, Slack sends block_suggestion events as the user types. Handle them with onOptionsLoad:
The return value must be an array of ['text' => string, 'value' => string]. The adapter converts to platform format.
Modal Events
ModalSubmitEvent:callbackId,values(map of actionId → value),user,viewId,relatedThreadModalCloseEvent:callbackId,user,viewId,relatedThread
Documentationn
Full API documentation: https://bootdesk.github.io/chat-sdk
License
MIT
All versions of chat-sdk-core with dependencies
psr/http-client Version ^1.0
psr/http-message Version ^1.0|^2.0
psr/http-factory Version ^1.0
psr/log Version ^1.0|^2.0|^3.0
league/commonmark Version ^2.0
moneyphp/money Version ^4.9
ramsey/uuid Version ^4.0|^5.0