webman Documentation

repository·master·Indexed 25 days ago

https://github.com/walkor/webman

An ultra-high-performance PHP framework built on the Workerman engine, optimized for high-concurrency networking tasks. Includes documentation on server configuration, application settings in config/app.php, and Docker Compose deployment.

Tokens
1.2K
Snippets
3
Records
7
Agent score
83%

What's inside webman

  1. Run Webman using Docker Compose

    master

    You can run the Webman application in a Docker container using the provided docker-compose.yml configuration. This setup builds the image from the current directory, maps the local project files to the /app directory inside the container for live development, and exposes port 8787.

    version: "3"
    services:
      webman:
        build: .
        container_name: docker-webman
        restart: unless-stopped
        volumes:
          - "./:/app"
        ports:
          - "8787:8787"
        command: ["php", "start.php", "start" ]
  2. Start the webman application

    master
    To start the webman application, execute the start.php script from your terminal. This script initializes the environment, loads the Composer autoloader, and invokes the support\App::run() method to launch the server.
  3. Configure application settings in config/app.php

    master

    The config/app.php file defines the core behavior of the webman application. You can modify these keys to control debugging, error reporting, timezones, and framework-level paths.

    Key configuration options include:

    • debug: Boolean to enable or disable debug mode.
    • error_reporting: PHP error reporting level (e.g., E_ALL).
    • default_timezone: The default timezone for the application.
    • request_class: The class used for handling requests (defaults to support\Request).
    • public_path: The directory for public assets.
    • runtime_path: The directory for runtime files/logs.
    • controller_suffix: The suffix appended to controller class names (defaults to Controller).
    • controller_reuse: Boolean determining if controller instances should be reused (defaults to false).
    return [
        'debug' => true,
        'error_reporting' => E_ALL,
        'default_timezone' => 'Asia/Shanghai',
        'request_class' => support\Request::class,
        'public_path' => base_path() . DIRECTORY_SEPARATOR . 'public',
        'runtime_path' => base_path(false) . DIRECTORY_SEPARATOR . 'runtime',
        'controller_suffix' => 'Controller',
        'controller_reuse' => false,
    ];
  4. Configure the webman server settings

    master

    The config/server.php file defines the core server behavior, including process management, file paths for PID and status, and logging. You can customize these settings to control how the server handles timeouts, package sizes, and where it writes its operational files.

    return [
        'event_loop' => '',
        'stop_timeout' => 2,
        'pid_file' => runtime_path() . '/webman.pid',
        'status_file' => runtime_path() . '/webman.status',
        'stdout_file' => runtime_path() . '/logs/stdout.log',
        'log_file' => runtime_path() . '/logs/workerman.log',
        'max_package_size' => 10 * 1024 * 1024
    ];
  5. Reference server configuration keys

    master

    The following configuration keys are available in config/server.php:

    KeyDescription
    event_loopSpecifies the event loop implementation to use. Leave empty for default.
    stop_timeoutThe number of seconds to wait for processes to exit gracefully before forcing them to stop.
    pid_filePath to the file storing the process ID (PID) of the master process.
    status_filePath to the file storing the server status information.
    stdout_filePath to the file where standard output (stdout) is redirected.
    log_filePath to the main Workerman log file.
    max_package_sizeThe maximum size (in bytes) of a single data package allowed. Default is 10MB.