Config

Config Fields

Name

Type

Explanation

Example

router

obj

Router(Request Method、Path、Handler、Middlewares)

See below

server

obj

Swoole Server Config

See below

redis

obj

Redis Config

See below

mysql

obj

MySQL Config

See below

log

obj

Log Config

See below

elasticsearch

obj

Elasticsearch Config

See below

middleware

array

Global Middlewares

[\App\middlewares\Cors::class]

cors

obj

Cross Domain Config

See below

storage

obj

Storage System Config

See below

timezone

string

Default Timezone

\App\components\Helper::env('TIMEZONE', 'PRC')

monitor

obj

Runtime Monitor Config

See below

amqp

obj

AMQP Protocol Config

See below

events

obj

Events & Listeners

Router Config

Name

Type

Explanation

Example

single

array

Router(Request Method、Path、Handler、Middlewares)

['GET', '/redis', [\App\services\DemoService::class, 'redis', [\App\middlewares\Cors::class]]]

group

obj

Group Router

Swoole Server Config

For detailed explanation, please see document.

Name

Type

Explanation

Example

host

string

Swoole Listening Host

127.0.0.1

port

int

Swoole Listening Port

9501

reactor_num

int

Swoole Reactor Thread Number

8

worker_num

int

Swoole Worker Process Number

32

daemonize

bool

Swoole Daemon Mode Switch

false

backlog

int

TCP Backlog Size

128

max_request

int

Swoole Worker Max Request

0

dispatch_mode

int

Swoole Request Dispatch Mode

2

Redis Config

Name

Type

Explanation

Example

host

string

Redis Server Host

127.0.0.1

port

int

Redis Server Port

6379

timeout

double

Redis Connection Timeout

1

pool_size

int

Redis Connection Pool Size

5

passwd

string

Redis Auth Password

null

db

int

Redis DB Index

0

switch

int

Redis Component Switch

0

prefix

string

Redis Key Prefix

sw-fw-less:

pool_change_event

int

Redis Pool Change Event

0

report_pool_change

int

Whether to report redis pool change event

0

MySQL Config

Name

Type

Explanation

Example

dsn

string

username

string

passwd

string

options

obj

pool_size

int

switch

int

pool_change_event

int

report_pool_change

int

Log Config

Name

Type

Explanation

Example

path

string

level

int

pool_size

int

buffer_max_size

int

name

string

reserve_days

int

switch

int

Elasticsearch Config

Name

Type

Explanation

Example

connections

obj

switch

int

Cross Domain Config

Name

Type

Explanation

Example

origin

string

switch

int

Storage System Config

Name

Type

Explanation

Example

base_path

string

switch

int

storage_path

string

types

array

['file', 'qiniu', 'alioss']

ext

obj

Runtime Monitor Config

Name

Type

Explanation

Example

switch

int

Monitor API Switch

0

AMQP Protocol Config

Name

Type

Explanation

Example

pool_size

int

switch

int

prefix

string

channel_id

int

host

string

port

int

user

string

passwd

string

vhost

string

locale

read_timeout

keepalive

write_timeout

heartbeat

pool_change_event

report_pool_change

ENV Fields

Name

Type

Explanation

Example

SERVER_HOST

SERVER_PORT

SERVER_REACTOR_NUM

SERVER_WORKER_NUM

SERVER_DAEMONIZE

SERVER_BACKLOG

SERVER_MAX_REQUEST

SERVER_DISPATCH_MODE

REDIS_HOST

REDIS_PORT

REDIS_TIMEOUT

REDIS_POOL_SIZE

REDIS_PASSWD

REDIS_DB

REDIS_SWITCH

REDIS_PREFIX

MYSQL_DSN

MYSQL_USERNAME

MYSQL_PASSWD

MYSQL_POOL_SIZE

MYSQL_SWITCH

LOG_PATH

LOG_LEVEL

LOG_POOL_SIZE

LOG_BUFFER_MAX_SIZE

LOG_NAME

LOG_RESERVE_DAYS

LOG_SWITCH

ES_DEFAULT_HOST

ES_SWITCH

ES_TIMEOUT

CORS_ORIGIN

CORS_SWITCH

APP_BASE_PATH

STORAGE_SWITCH

STORAGE_PATH

STORAGE_TYPES

QINIU_DEFAULT_BUCKET

QINIU_DEFAULT_ACCESS_KEY

QINIU_DEFAULT_SECRET_KEY

QINIU_DEFAULT_DOMAIN

TIMEZONE

MONITOR_SWITCH

Last updated

Was this helpful?