Mercurius - Laravel 的 Messenger" style="max-width: 100%;">
mercurius是一个使用 Laravel 和 Vue.js 的实时消息系统,具有完整的应用程序,您可以轻松地在任何 Laravel 项目中安装它。
您可以尝试mercurius的演示。使用以下任一凭据进行身份验证:
密码: password
提示:打开2个不同的浏览器并使用不同的用户名登录,以便您可以测试发送/接收消息。
在继续之前确保 Laravel 5.6
+ 已安装。
如果您没有帐户,请在 Pusher.com 网站上创建一个免费帐户。转到仪表板,创建一个新应用程序并记下 API 凭据。
现在,让我们将 API 密钥添加到.env
文件中。另外,将BROADCAST_DRIVER
更改为pusher
(默认为log
)。
. . .
BROADCAST_DRIVER =pusher
. . .
PUSHER_APP_ID ="xxxxxx"
PUSHER_APP_KEY ="xxxxxxxxxxxxxxxxxxxx"
PUSHER_APP_SECRET ="xxxxxxxxxxxxxxxxxxxx"
PUSHER_APP_CLUSTER ="xx"
BroadcastServiceProvider
打开config/app.php
并取消注释行AppProvidersBroadcastServiceProvider::class,
。
如果身份验证已设置,请跳过此步骤,否则键入:
php artisan make:auth
composer require launcher/ mercurius
如果要更改默认配置,请通过键入以下命令来发布配置文件:
php artisan vendor:publish --tag= mercurius -config
要编辑配置,请打开/config/ mercurius .php
并添加您自己的值。
return [
/*
|--------------------------------------------------------------------------
| mercurius Models
|--------------------------------------------------------------------------
|
| Defines the models used with mercurius , use it to extend mercurius and
| create your own implementation.
|
*/
' models ' => [
' user ' => App User::class,
' messages ' => Launcher mercurius Models Message::class,
],
/*
|--------------------------------------------------------------------------
| User Table Fields
|--------------------------------------------------------------------------
|
| You can specify the column names for the user table. The `name` accepts
| an array of fields, for building custom names with multiple columns.
|
*/
' fields ' => [
// 'name' => ['first_name', 'last_name'],
' name ' => ' name ' ,
' slug ' => ' slug ' ,
' avatar ' => ' avatar ' ,
],
];
php artisan mercurius :install
composer dump-autoload
将Launcher mercurius mercurius User
特征添加到您的User
模型中:
// ...
use Illuminate Foundation Auth User as Authenticatable ;
use Launcher mercurius mercurius User ;
class User extends Authenticatable
{
use mercurius User;
// ...
}
php artisan db:seed --class= mercurius DatabaseSeeder
将向系统添加消息和用户,如演示示例所示:
演示用户:
密码: password
每当您更新mercurius时,请确保发布资源以应用新版本的 CSS/JS。
php artisan vendor:publish --tag= mercurius -public --force
请参阅定制以获取更多信息。
查看路线图以获取更多信息。
请参阅贡献以获取更多信息。
我们保留变更日志,其中包含已更改的信息。
版权所有 2018 布鲁诺·托林哈。 mercurius是根据 MIT 许可证发布的。