PHP code example of backtik-ch / laravel-kchat-sdk
1. Go to this page and download the library: Download backtik-ch/laravel-kchat-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
backtik-ch / laravel-kchat-sdk example snippets
use Backtik\KChat\Facades\KChat;
$post = KChat::messages()
->toChannel('channel_id')
->message('Hello')
->send();
use Backtik\KChat\Exceptions\KChatNotFoundException;
use Backtik\KChat\Exceptions\KChatRequestException;
use Backtik\KChat\Facades\KChat;
try {
$post = KChat::messages()
->toUsername('simon')
->message('**Hello**')
->send();
} catch (KChatNotFoundException $exception) {
// user or post not found
} catch (KChatRequestException $exception) {
// request failed
}
use Backtik\KChat\Facades\KChat;
KChat::messages()
->toChannel('channel_id')
->message('Hello from the local SDK')
->send();
use Backtik\KChat\Facades\KChat;
use Illuminate\Support\Facades\Route;
Route::get('/test-kchat', function () {
$post = KChat::messages()
->toChannel('channel_id')
->message('Test from Laravel')
->send();
return $post->raw();
});