twedoo / volcator

Twedoo Volcator 快速构建应用程序,提供可配置的多个模块,提供现代内容管理系统(CMS)。

安装: 107

依赖项: 0

建议者: 0

安全: 0

星标: 6

关注者: 2

分支: 2

开放问题: 0

语言:JavaScript

3.10 2024-04-27 13:37 UTC

This package is auto-updated.

Last update: 2024-09-27 14:46:51 UTC


README

Latest Version on Packagist Total Downloads Build Status

这里应该是您的描述。请参阅 contributing.md 以查看待办事项列表。

版本

此 3.x 版本的 volcator 尚未准备好使用!
我们正在努力并且聪明地使其达到生产阶段 ^_^!
我们的截止日期是 2022年8月28日

安装

通过 Composer

$ composer require twedoo/volcator

发布 volcator 视图和翻译(语言)

php artisan vendor:publish --provider="Twedoo\Volcator\VolcatorServiceProvider"

用法

从 Laravel scratch 项目安装 Laravel 和 Volcator 的默认迁移表(应在 .env 中添加数据库连接并运行命令

$ php artisan volcator:migration
$ php artisan migrate:install
$ php artisan migrate
php artisan volcator:seeder

另一种方法是使用单行命令

php artisan volcator:migration && php artisan migrate:install && php artisan migrate && php artisan volcator:seeder

从现有项目

$ php artisan volcator:migration

迁移所有 volcator 表

$ php artisan migrate

将模型 User App\Models\User 修改为

namespace App\Models;

use Twedoo\VolcatorGuard\Models\User as VolcatorUser;

class User extends VolcatorUser
{
    /**
     *
     */
}

完成:D 刷新您的应用程序!

对于开发者(模式 Dev)

只有模式 Dev 使用单行命令来清除所有 Volcator 表并自动重新生成它们

php artisan volcator:migration -p true && php artisan volcator:migration  && php artisan migrate:install && php artisan migrate && php artisan volcator:seeder

使用 Devilbox 配置 WebSocket

npm run dev && php artisan websockets:serve --host=127.0.0.1

应在与项目相同的容器中运行此命令以挂载主机的 WebSocket Laravel

Soketi 环境变量

{
    ADAPTER_DRIVER: 'adapter.driver',
    ADAPTER_REDIS_PREFIX: 'adapter.redis.prefix',
    APP_MANAGER_DRIVER: 'appManager.driver',
    APP_MANAGER_DYNAMODB_TABLE: 'appManager.dynamodb.table',
    APP_MANAGER_DYNAMODB_REGION: 'appManager.dynamodb.region',
    APP_MANAGER_DYNAMODB_ENDPOINT: 'appManager.dynamodb.endpoint',
    APP_MANAGER_MYSQL_TABLE: 'appManager.mysql.table',
    APP_MANAGER_MYSQL_VERSION: 'appManager.mysql.version',
    APP_MANAGER_POSTGRES_TABLE: 'appManager.postgres.table',
    APP_MANAGER_POSTGRES_VERSION: 'appManager.postgres.version',
    APP_MANAGER_MYSQL_USE_V2: 'appManager.mysql.useMysql2',
    CHANNEL_LIMITS_MAX_NAME_LENGTH: 'channelLimits.maxNameLength',
    DEBUG: 'debug',
    DEFAULT_APP_ID: 'appManager.array.apps.0.id',
    DEFAULT_APP_KEY: 'appManager.array.apps.0.key',
    DEFAULT_APP_SECRET: 'appManager.array.apps.0.secret',
    DEFAULT_APP_MAX_CONNS: 'appManager.array.apps.0.maxConnections',
    DEFAULT_APP_ENABLE_CLIENT_MESSAGES: 'appManager.array.apps.0.enableClientMessages',
    DEFAULT_APP_ENABLED: 'appManager.array.apps.0.enabled',
    DEFAULT_APP_MAX_BACKEND_EVENTS_PER_SEC: 'appManager.array.apps.0.maxBackendEventsPerSecond',
    DEFAULT_APP_MAX_CLIENT_EVENTS_PER_SEC: 'appManager.array.apps.0.maxClientEventsPerSecond',
    DEFAULT_APP_MAX_READ_REQ_PER_SEC: 'appManager.array.apps.0.maxReadRequestsPerSecond',
    DEFAULT_APP_WEBHOOKS: 'appManager.array.apps.0.webhooks',
    DB_POOLING_ENABLED: 'databasePooling.enabled',
    DB_POOLING_MIN: 'databasePooling.min',
    DB_POOLING_MAX: 'databasePooling.max',
    DB_MYSQL_HOST: 'database.mysql.host',
    DB_MYSQL_PORT: 'database.mysql.port',
    DB_MYSQL_USERNAME: 'database.mysql.user',
    DB_MYSQL_PASSWORD: 'database.mysql.password',
    DB_MYSQL_DATABASE: 'database.mysql.database',
    DB_POSTGRES_HOST: 'database.postgres.host',
    DB_POSTGRES_PORT: 'database.postgres.port',
    DB_POSTGRES_USERNAME: 'database.postgres.user',
    DB_POSTGRES_PASSWORD: 'database.postgres.password',
    DB_POSTGRES_DATABASE: 'database.postgres.database',
    DB_REDIS_HOST: 'database.redis.host',
    DB_REDIS_PORT: 'database.redis.port',
    DB_REDIS_DB: 'database.redis.db',
    DB_REDIS_USERNAME: 'database.redis.username',
    DB_REDIS_PASSWORD: 'database.redis.password',
    DB_REDIS_KEY_PREFIX: 'database.redis.keyPrefix',
    DB_REDIS_SENTINELS: 'database.redis.sentinels',
    DB_REDIS_SENTINEL_PASSWORD: 'database.redis.sentinelPassword',
    DB_REDIS_INSTANCE_NAME: 'database.redis.name',
    EVENT_MAX_CHANNELS_AT_ONCE: 'eventLimits.maxChannelsAtOnce',
    EVENT_MAX_NAME_LENGTH: 'eventLimits.maxNameLength',
    EVENT_MAX_SIZE_IN_KB: 'eventLimits.maxPayloadInKb',
    METRICS_ENABLED: 'metrics.enabled',
    METRICS_DRIVER: 'metrics.driver',
    METRICS_PROMETHEUS_PREFIX: 'metrics.prometheus.prefix',
    METRICS_SERVER_PORT: 'metrics.port',
    PORT: 'port',
    PATH_PREFIX: 'pathPrefix',
    PRESENCE_MAX_MEMBER_SIZE: 'presence.maxMemberSizeInKb',
    PRESENCE_MAX_MEMBERS: 'presence.maxMembersPerChannel',
    QUEUE_DRIVER: 'queue.driver',
    QUEUE_REDIS_CONCURRENCY: 'queue.redis.concurrency',
    RATE_LIMITER_DRIVER: 'rateLimiter.driver',
    SSL_CERT: 'ssl.certPath',
    SSL_KEY: 'ssl.keyPath',
    SSL_PASS: 'ssl.passphrase',
};

环境变量 .env VolcatorEcho

PUSHER_STONE_FORCE_TLS=
PUSHER_STONE_ENCRYPTED=
PUSHER_STONE_WS_HOST='127.0.0.1'
PUSHER_STONE_WS_PORT=6001
PUSHER_STONE_WSS_PORT=6001

MIX_PUSHER_STONE_FORCE_TLS="${PUSHER_STONE_FORCE_TLS}"
MIX_PUSHER_STONE_ENCRYPTED="${PUSHER_STONE_ENCRYPTED}"
MIX_PUSHER_STONE_WS_HOST="${PUSHER_STONE_WS_HOST}"
MIX_PUSHER_STONE_WS_PORT="${PUSHER_STONE_WS_PORT}"
MIX_PUSHER_STONE_WSS_PORT="${PUSHER_STONE_WSS_PORT}"

Pusher 调用方法


import Echo from './echo.js';
import {Pusher} from './pusher.js';
window.Pusher = Pusher;

window.VolcatorEcho =  new Echo({
    broadcaster: 'pusher',
    key: window.PUSHER_APP_KEY,
    cluster: window.PUSHER_APP_CLUSTER,
    forceTLS: !!window.PUSHER_STONE_FORCE_TLS,
    wsHost: window.PUSHER_STONE_WS_HOST,
    wsPort: window.PUSHER_STONE_WS_PORT,
    wssPort: window.PUSHER_STONE_WSS_PORT,
    encrypted: !!window.PUSHER_STONE_ENCRYPTED,
    enabledTransports: ['ws', 'wss']
});


window.VolcatorEcho.channel('notification.'+window.currentUserId).listen('.notifyNotification', (event) => {
    toastr.success('Hé, <b>ça marche !</b>', '<a href="javascript: void(0);" class="btn btn-outline-primary mb-1">View history</a>');
    console.log(event);
});

变更日志

请参阅 changelog 了解最近更改的详细信息。

测试

$ composer test

贡献

请参阅 contributing.md 了解详情和待办事项列表。

安全

如果您发现任何安全相关的问题,请通过电子邮件 houssem.maamria@twedoo.com 联系我们,而不是使用问题跟踪器。

致谢

许可协议

MIT。有关更多信息,请参阅 许可文件