2017 © Pedro Peláez
 

library laravel-video-chat

Laravel Video Chat using Socket.IO and WebRTC

image

php-junior/laravel-video-chat

Laravel Video Chat using Socket.IO and WebRTC

  • Saturday, December 2, 2017
  • by Nyi Nyi Lwin
  • Repository
  • 31 Watchers
  • 291 Stars
  • 1,402 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 63 Forks
  • 8 Open issues
  • 9 Versions
  • 23 % Grown

The README.md

Laravel Video Chat

Laravel Video Chat using Socket.IO and WebRTC, (*1)

Build Status StyleCI Latest Stable Version Total Downloads, (*2)

Installation

composer require php-junior/laravel-video-chat

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider., (*3)

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php, (*4)

PhpJunior\LaravelVideoChat\LaravelVideoChatServiceProvider::class,
php artisan vendor:publish --provider="PhpJunior\LaravelVideoChat\LaravelVideoChatServiceProvider"

And, (*5)

php artisan migrate
php artisan storage:link

change APP_URL in .env

This is the contents of the published config file:, (*6)

return [
    'relation'  => [
        'conversations' =>  PhpJunior\LaravelVideoChat\Models\Conversation\Conversation::class,
        'group_conversations' => PhpJunior\LaravelVideoChat\Models\Group\Conversation\GroupConversation::class
    ],
    'user' => [
        'model' =>  App\User::class,
        'table' =>  'users' // Existing user table name
    ],
    'table' => [
        'conversations_table'   =>  'conversations',
        'messages_table'        =>  'messages',
        'group_conversations_table' =>  'group_conversations',
        'group_users_table'     =>  'group_users',
        'files_table'           =>  'files'
    ],
    'channel'   =>  [
        'new_conversation_created'  =>  'new-conversation-created',
        'chat_room'                 =>  'chat-room',
        'group_chat_room'           =>  'group-chat-room'
    ],
    'upload' => [
        'storage' => 'public'
    ]
];

Uncomment App\Providers\BroadcastServiceProvider in the providers array of your config/app.php configuration file, (*7)

Install the JavaScript dependencies:, (*8)

    npm install
    npm install --save laravel-echo js-cookie vue-timeago socket.io socket.io-client webrtc-adapter vue-chat-scroll

If you are running the Socket.IO server on the same domain as your web application, you may access the client library like, (*9)

<script src="//{{ Request::getHost() }}:6001/socket.io/socket.io.js"></script>

in your application's head HTML element, (*10)

Next, you will need to instantiate Echo with the socket.io connector and a host., (*11)

 require('webrtc-adapter');
 window.Cookies = require('js-cookie');

 import Echo from "laravel-echo"

 window.io = require('socket.io-client');

 window.Echo = new Echo({
     broadcaster: 'socket.io',
     host: window.location.hostname + ':6001'
 });

Finally, you will need to run a compatible Socket.IO server. Use tlaverdure/laravel-echo-server GitHub repository., (*12)

In resources/assets/js/app.js file:, (*13)

 import VueChatScroll from 'vue-chat-scroll';
 import VueTimeago from 'vue-timeago';

 Vue.use(VueChatScroll);
 Vue.component('chat-room' , require('./components/laravel-video-chat/ChatRoom.vue'));
 Vue.component('group-chat-room', require('./components/laravel-video-chat/GroupChatRoom.vue'));
 Vue.component('video-section' , require('./components/laravel-video-chat/VideoSection.vue'));
 Vue.component('file-preview' , require('./components/laravel-video-chat/FilePreview.vue'));

 Vue.use(VueTimeago, {
     name: 'timeago', // component name, `timeago` by default
     locale: 'en-US',
     locales: {
         'en-US': require('vue-timeago/locales/en-US.json')
     }
 })

Run npm run dev to recompile your assets., (*14)

Features

  • One To One Chat ( With Video Call )
  • Accept Message Request
  • Group Chat
  • File Sharing

Usage

Get All Conversation and Group Conversation

$groups = Chat::getAllGroupConversations();
$conversations = Chat::getAllConversations()


Start Conversation

Chat::startConversationWith($otherUserId);

Accept Conversation

Chat::acceptMessageRequest($conversationId);

Get Conversation Messages

$conversation = Chat::getConversationMessageById($conversationId);
<chat-room :conversation="{{ $conversation }}" :current-user="{{ auth()->user() }}"></chat-room>

Send Message

You can change message send route in component, (*15)

Chat::sendConversationMessage($conversationId, $message);

Start Video Call ( Not Avaliable On Group Chat )

You can change video call route . I defined video call route trigger/{id} method POST Use $request->all() for video call., (*16)

Chat::startVideoCall($conversationId , $request->all());

Start Group Conversation

Chat::createGroupConversation( $groupName , [ $otherUserId , $otherUserId2 ]);

Get Group Conversation Messages

$conversation = Chat::getGroupConversationMessageById($groupConversationId);
<group-chat-room :conversation="{{ $conversation }}" :current-user="{{ auth()->user() }}"></group-chat-room>

Send Group Chat Message

You can change message send route in component, (*17)

Chat::sendGroupConversationMessage($groupConversationId, $message);

Add Members to Group

Chat::addMembersToExistingGroupConversation($groupConversationId, [ $otherUserId , $otherUserId2 ])

Remove Members from Group

Chat::removeMembersFromGroupConversation($groupConversationId, [ $otherUserId , $otherUserId2 ])

Leave From Group

Chat::leaveFromGroupConversation($groupConversationId);

File Sharing

Run this command php artisan storage:link, (*18)

Send Files in Conversation

Chat::sendFilesInConversation($conversationId , $request->file('files'));

Send Files in Group Conversation

Chat::sendFilesInGroupConversation($groupConversationId , $request->file('files'));

ToDo

  • Add Members to Group
  • Remove Member From Group

Next Version

  • Group Video Call

Credits

  • All Contributors

License

The MIT License (MIT). Please see License File for more information., (*19)

Demo Project, (*20)

Support on Beerpay

Hey dude! Help me out for a couple of :beers:!, (*21)

Beerpay Beerpay, (*22)

The Versions

02/12 2017

v1.1.5

1.1.5.0

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

02/12 2017

dev-master

9999999-dev

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

02/12 2017

v1.1.4

1.1.4.0

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

09/11 2017

v1.1.3

1.1.3.0

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

09/11 2017

dev-analysis-8mdZJV

dev-analysis-8mdZJV

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

08/11 2017

v1.1.2

1.1.2.0

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

08/11 2017

v1.1.1

1.1.1.0

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

24/10 2017

v1.0.1

1.0.1.0

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat

22/10 2017

v1.0

1.0.0.0

Laravel Video Chat using Socket.IO and WebRTC

  Sources   Download

MIT

The Requires

 

by Avatar Nyi Nyi Lwin

laravel realtime chat socket.io webrtc video-chat