承接 underthecocotree/laravel-chat 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

underthecocotree/laravel-chat

Composer 安装命令:

composer require underthecocotree/laravel-chat

包简介

A chat module built for laravel using socket.io

README 文档

README

Install

config/app.php

// providers
Underthecocotree\LaravelChat\Providers\LaravelChatServiceProvider::class,

// aliases
'Chat' => Underthecocotree\LaravelChat\Facades\Chat::class,

EventServiceProvider

Use if you want to fire events for socket, not needed for chat

protected $listen = [

    'Underthecocotree\LaravelChat\Events\UserHasRegistered' => [
        'Underthecocotree\LaravelChat\Listeners\Email@welcome',
    ],

Artisan publish views

artisan vendor:publish

## use force if you want to overwrite
artisan vendor:publish --force

NPM Dependencies

npm install express ioredis redis socket.io --save

Config

config/broadcasting.php

'default' => env('BROADCAST_DRIVER', 'redis'),

Running

Server

Will need a monit to keep the service going in case it crashes

node assets/js/socket.js

# debug mode
node underthecocotree/laravel-chat/src/resources/assets/js/socket.js --debug

Chat frontend

Use in route.php as a standalone

// pass a room name to the facade - default is room
Route::get('/chat', function () {
	return Chat::standalone();
});

Route::get('/standalone-room', function () {
	return Chat::standalone('standalone-room');
});

// Pass a username to the facade, default is Anonymous
// $user = \Auth::user();
// return Chat::standalone('standalone-room', $user->name);
return Chat::standalone('standalone-room', 'Iordanis');

Use as a partial in a blade template

// defautl name is room
{!! Chat::partial() !!} 

// provide a name for the room
{!! Chat::partial('new-room') !!}

or @include('chat::partial-chat')

统计信息

  • 总下载量: 43
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固