Download the PHP package ody/server without Composer

On this page you can find all versions of the php package ody/server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package server

Actions Status License

Ody Server

Ody Server is a package for the Ody PHP framework that provides high-performance HTTP server capabilities powered by Swoole. It offers easy server management with command-line tools, hot-reloading support, and administrative features.

Table of Contents

Introduction

Ody Server simplifies the process of creating and managing Swoole-based servers. It provides:

Installation

Basic Usage

Starting a Server

To start a server, use the server:start command:

Options:

Stopping a Server

To stop a running server:

Reloading a Server

To reload workers without stopping the server:

Configuration

Server configuration should be defined in your application's config/server.php file:

Server Management

The ServerManager class provides an interface for creating and managing Swoole servers.

Server Events

The following server events can be registered in your configuration:

Event Description
ON_START Triggered when the server starts
ON_WORKER_START Triggered when a worker process starts
ON_WORKER_STOP Triggered when a worker process stops
ON_WORKER_EXIT Triggered when a worker process exits
ON_WORKER_ERROR Triggered when a worker process encounters an error
ON_PIPE_MESSAGE Triggered when a message is sent through pipes
ON_REQUEST Triggered when an HTTP request is received
ON_RECEIVE Triggered when data is received
ON_CONNECT Triggered when a client connects
ON_DISCONNECT Triggered when a client disconnects
ON_OPEN Triggered when a WebSocket connection is opened
ON_MESSAGE Triggered when a WebSocket message is received
ON_CLOSE Triggered when a connection is closed
ON_TASK Triggered when a task is received
ON_FINISH Triggered when a task is finished
ON_SHUTDOWN Triggered when the server shuts down
ON_PACKET Triggered when a UDP packet is received
ON_MANAGER_START Triggered when the manager process starts
ON_MANAGER_STOP Triggered when the manager process stops
ON_BEFORE_START Triggered before the server starts (not a Swoole event)

Server State

The HttpServerState class manages the state of running server processes, allowing for tracking and management of processes.

Admin Server

!! Use with caution, very experimental and likely to break !!

The AdminServer class provides an administrative interface for monitoring and managing Swoole servers. It exposes a RESTful API for interacting with the server processes.

To enable the Admin server, add the following to your server configuration:

You can access a web-based dashboard at http://your-admin-server:port/dashboard.

Authentication

The admin server supports authentication via the admin_server URI:

When authenticated, an access token is generated as sha1(username . password) and must be provided in the X-ADMIN-SERVER-ACCESS-TOKEN HTTP header.

API Endpoints

The admin server exposes a RESTful API at the /api endpoint. The URL structure is:

Where:

Available Commands

Command Description HTTP Method
server_reload Reload worker processes POST
server_shutdown Shut down the server POST
server_stats Get server statistics GET
server_setting Get server configuration GET
coroutine_stats Get coroutine statistics GET
coroutine_list Get active coroutines GET
coroutine_bt Get coroutine backtrace POST
get_version_info Get version information GET
get_worker_info Get worker process information GET
get_timer_list Get active timers GET
get_server_memory_usage Get memory usage GET
get_server_cpu_usage Get CPU usage GET
close_session Close a client connection POST
get_client_info Get client information GET

Example Requests

Retrieve server statistics:

Reload the server:

Get coroutine list from all worker processes:

Close a client connection:

API Reference

Server Types

The ServerType class provides constants for different server types:

Server Events

The ServerEvent class provides constants for all supported server events:

ServerManager Class

Methods:

ServerState Class

Methods:

HttpServerState Class

Methods:

AdminServer Class

Methods:

ServerCallbacks Class

Static methods:


All versions of server with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ody/swoole Version ^0.1.0
psr/http-message Version ^2.0
psr/http-server-handler Version ^1.0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ody/server contains the following files

Loading the files please wait ....