Download the PHP package backtik-ch/laravel-kchat-sdk without Composer
On this page you can find all versions of the php package backtik-ch/laravel-kchat-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download backtik-ch/laravel-kchat-sdk
More information about backtik-ch/laravel-kchat-sdk
Files in backtik-ch/laravel-kchat-sdk
Package laravel-kchat-sdk
Short Description This package helps you posting messages on kChat.
License MIT
Homepage https://github.com/backtik-ch/laravel-kchat-sdk
Informations about the package laravel-kchat-sdk
Laravel kChat SDK
Laravel SDK for sending kChat messages with a bot token and reading kChat users.
Installation
Publish the config:
Configuration
KCHAT_TOKEN is the bot token used as Authorization: Bearer .... KCHAT_BOT_USER_ID is required for direct messages because the SDK creates or reuses the private channel between the bot and the target user.
Messages
Send to a channel by channel id:
Markdown is just message content:
Send a private message by user id:
Send a private message by username:
Reply in a thread:
Read, update and delete posts:
Override the bot display name or avatar for one message:
Add color attachments:
Attach a local file:
Users
Exceptions
Public methods return typed DTOs or throw an exception. They do not return false.
Available exceptions:
KChatConfigurationExceptionKChatAuthenticationExceptionKChatAuthorizationExceptionKChatNotFoundExceptionKChatValidationExceptionKChatRequestException
Exceptions include the endpoint, HTTP status when available, and non-sensitive context. The SDK never includes the bot token in exception messages.
DTOs
The SDK returns typed DTOs:
KChatPostKChatUserKChatFileInfoKChatChannel
Each DTO exposes common fields with methods such as id(), message(), username(), and keeps the full payload available through raw().
Security
Keep the bot token in config or .env; do not hard-code it in application code. The bot must have permission to post in target channels, create or access direct message channels, upload files, and optionally use message display overrides if your kChat server restricts that feature.
attachFile() accepts local files only. It validates that the path exists and is readable before upload.
Laravel Boost
This package ships with Laravel Boost resources. If your application uses Laravel Boost, run the installer to publish the package guidelines and skills automatically:
The published resources include:
- AI guidelines with an overview of the SDK, required configuration, core conventions, and usage examples.
- Skill
kchat-sdk-developmentwith detailed patterns for sending messages, managing attachments and threads, handling exceptions, and testing.
Testing
Testing in a Local Laravel App
To test this package inside a Laravel application before publishing a release, use a local Composer path repository.
In the Laravel app composer.json, add:
Adjust url to the relative path between the Laravel app and this package.
Then install the package in the Laravel app:
Publish the config in the Laravel app:
Configure the Laravel app .env with the kChat server URL, bot token, and bot user id.
You can test quickly with Tinker:
Or with a temporary route:
With "symlink": true, changes made in this package are immediately used by the Laravel app. If you add or move classes, run this in the Laravel app:
All versions of laravel-kchat-sdk with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0
illuminate/http Version ^11.0||^12.0||^13.0