Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nattaponra/chatkun
Laravel package for make sample chat application with Pusher service
https://github.com/nattaponra/chatkun
chat chatbox chatroom laravel pusher
Last synced: 25 days ago
JSON representation
Laravel package for make sample chat application with Pusher service
- Host: GitHub
- URL: https://github.com/nattaponra/chatkun
- Owner: nattaponra
- Created: 2017-05-15T15:23:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-01T05:12:37.000Z (over 6 years ago)
- Last Synced: 2024-04-21T01:01:53.031Z (9 months ago)
- Topics: chat, chatbox, chatroom, laravel, pusher
- Language: PHP
- Homepage:
- Size: 83 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# chatkun
## Install library with composer.
Install Package with Composer
You can use composer to install chatkun package follow below command.
```
composer require nattaponra/chatkun
```## 1.Add Service Provider
```php
'providers' => [/*
* Laravel Framework Service Providers...
*/
.
.
.
.
nattaponra\chatkun\ChatKunServiceProvider::class,
```
## 2.Add trait in User model
Execute the vendor:publish command to create config file in your project:
```
php artisan vendor:publish --provider=ChatKunServiceProvider
```## 3.Using
```php
$user1 = User::find(1);
$user2 = User::find(2);$room = ChatKun::createRoom("Our Room");
ChatKun::addMember($user1,$room);
ChatKun::addMember($user2,$room);ChatKun::send($user1,$room,"message","hi!! user2");
ChatKun::send($user2,$room,"message","hi!! user1");
ChatKun::send($user1,$room,"image","http://pwtthemes.com/demo/hannari/wp-content/uploads/2013/03/unicorn-wallpaper.jpg");$results = ChatKun::history(1,10);
foreach ($results as $result){
if($result->message_type == "image"){
echo "User:".$result->user_id." Say that
";
}else{
echo "User:".$result->user_id." Say that ".$result->message_content."
";
}
}
```