sybiont/workerman

在Workerman RoadRunner上的Symbiotic服务器

1.4.1.2 2024-06-05 18:47 UTC

This package is auto-updated.

Last update: 2024-09-05 19:18:16 UTC


README

安装

composer require symbiotic/workerman

使用额外包安装

{
  "require": {
    "symbiotic/workerman": "^1.4",
    "symbiotic/auth-login": "^1.4",
    "symbiotic/develop": "^1.4"
  }
}

使用方法

  1. 根据文档初始化框架: Symbiotic快速开始
  2. 将session存储替换为文件存储(以下说明)和配置。
  3. 在控制台运行 php ./index.php workerman:worker start --host=127.0.0.1 --port=80
  4. 请求 http://127.0.0.1/symbiotic/(将出现错误#7623)

配置index.php

$basePath = dirname(__DIR__);// root folder of the project

include_once $basePath. '/vendor/autoload.php';

$config = include $basePath.'/vendor/symbiotic/full/src/config.sample.php';

// Replace section in symbiotic core configuration
$config['default_host'] = '127.0.0.1';
// for first run 
$config['debug'] = true;
// If you are using a native session driver, you need to replace it with another one,
// the framework already has a file driver for storing sessions, you need to switch to it:
$config['session'] = [
    'driver' => 'file',
    'minutes' => 1200,
    'name' => session_name(),
    'path' => session_save_path(),
    'namespace' => '5a8309dedb810d2322b6024d536832ba',
    'secure' => false,
    'httponly' => true,
    'same_site' => null,
];

// if installed package `symbiotic/auth-login`
$config['auth'] =  [
    'users' =>[
        [
            'login' => 'admin',
            /** @see \Symbiotic\Auth\UserInterface::GROUP_ADMIN  and other groups **/
            'access_group' => \Symbiotic\Auth\UserInterface::GROUP_ADMIN, //admin
            // Password in https://php.ac.cn/manual/ru/function.password-hash.php
            // algo - PASSWORD_BCRYPT
            'password' => '$2y$10$fblGNBFYBjC9a3L6d0.lle1BoVFdMlMOzN6/NWjqBb8wFlJZt9P8C'//
        ]
    ],
    'base_login' => true, // enabling and disabling login authorization
];

// Basic construction of the Core container
$core = new \Symbiotic\Core\Core($config);

/**
 * When installing the symbiotic/full package, a cached container is available
 * Initialization in this case occurs through the Builder:
 */
$cache = new Symbiotic\Cache\FilesystemCache($config['storage_path'] . '/cache/core');
$core = (new \Symbiotic\Core\ContainerBuilder($cache))
    ->buildCore($config);

// Starting request processing
$core->run();