### micro Wiki EN - Adding Extension Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Client Guide on how to add a PHP extension to the micro project, in English. ```APIDOC micro How to Add Extension (EN): Provides instructions on integrating custom PHP extensions into the micro project. ``` -------------------------------- ### Swow API Reference Overview Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Protocol This section provides an overview of the Swow API, listing key namespaces and classes available for use. It serves as a starting point for exploring the library's functionalities. ```APIDOC Namespace Swow\Stream: - StreamException - VarStream Trait Swow\Stream\MaxMessageLengthTrait Namespace Swow\Sync: - WaitGroup - WaitReference Namespace Swow\Utils: - Handler Namespace Swow\WebSocket: - Header - Opcode - Status - WebSocket Namespace Swow: - Swow Namespace Swow\Psr7\Protocol: Trait WebSocketTrait ``` -------------------------------- ### Swow API Reference Source: https://docs.toast.run/swow-api/ci/Swow/WatchdogException This section provides an overview of the Swow API, listing key namespaces and classes available for use. It serves as a starting point for exploring the library's components. ```APIDOC Namespace Swow\Stream: Class Swow\Stream\StreamException Class Swow\Stream\VarStream Trait Swow\Stream\MaxMessageLengthTrait Namespace Swow\Sync: Class Swow\Sync\WaitGroup Class Swow\Sync\WaitReference Namespace Swow\Utils: Class Swow\Utils\Handler Namespace Swow\WebSocket: Class Swow\WebSocket\Header Class Swow\WebSocket\Opcode Class Swow\WebSocket\Status Class Swow\WebSocket\WebSocket Namespace: Class Swow ``` -------------------------------- ### Swow API Namespace and Class Overview Source: https://docs.toast.run/swow-api/ci/Swow/SyncException This section outlines the structure of the Swow API, listing key namespaces and classes available for use. It serves as a navigational guide to the different components of the library. ```APIDOC Namespace Swow\Stream: Class Swow\Stream\StreamException Class Swow\Stream\VarStream Trait Swow\Stream\MaxMessageLengthTrait Namespace Swow\Sync: Class Swow\Sync\WaitGroup Class Swow\Sync\WaitReference Namespace Swow\Utils: Class Swow\Utils\Handler Namespace Swow\WebSocket: Class Swow\WebSocket\Header Class Swow\WebSocket\Opcode Class Swow\WebSocket\Status Class Swow\WebSocket\WebSocket Namespace : Class Swow ``` -------------------------------- ### Swow API Reference Overview Source: https://docs.toast.run/swow-api/ci/Swow/Utils This section provides an overview of the Swow API structure, listing key namespaces and classes available for use. It serves as a starting point for exploring the library's capabilities. ```APIDOC Swow API Reference (ci): https://docs.toast.run/swow-api/ci.html Namespaces: Swow\Stream Swow\Sync Swow\Utils Swow\WebSocket Classes: Swow\Stream\StreamException Swow\Stream\VarStream Swow\Stream\MaxMessageLengthTrait Swow\Sync\WaitGroup Swow\Sync\WaitReference Swow\Utils\Handler Swow\WebSocket\Header Swow\WebSocket\Opcode Swow\WebSocket\Status Swow\WebSocket\WebSocket Swow ``` -------------------------------- ### micro Wiki EN Documentation Source: https://docs.toast.run/swow-api/ci/Swow/SocketException Provides links to the English version of the micro Wiki, covering 'How micro work', 'SAPI Interface', 'INI Configuration', 'Section Settings', and 'How to add an extension into micro.sfx'. ```APIDOC micro Wiki EN: How micro work: https://docs.toast.run/micro/en/how-micro-work.html SAPI Interface: https://docs.toast.run/micro/en/sapi-interface.html INI Configuration: https://docs.toast.run/micro/en/ini-settings.html Section Settings: https://docs.toast.run/micro/en/sections.html How to add an extension into micro.sfx: https://docs.toast.run/micro/en/how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### SwowPsr7ServerServerConnectionFactoryTrait API Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Server/ServerConnectionFactoryTrait Documentation for the ServerConnectionFactoryTrait in SwowPsr7Server. This trait manages the ServerConnectionFactory, providing methods to get and set it. ```APIDOC Trait ServerConnectionFactoryTrait Properties: protected $serverConnectionFactory Methods: __constructServerConnectionFactory(?ServerConnectionFactoryInterface $serverConnectionFactory): void Constructs the trait with an optional ServerConnectionFactoryInterface. getServerConnectionFactory(): ServerConnectionFactoryInterface Retrieves the ServerConnectionFactory. setServerConnectionFactory(ServerConnectionFactoryInterface $serverConnectionFactory): static Sets the ServerConnectionFactory. ``` -------------------------------- ### Micro Wiki EN Documentation Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Server This provides links to the micro Wiki documentation in English, covering topics such as 'How micro works', 'SAPI Interface', 'INI Configuration', 'Section Settings', and 'How to add an extension into micro.sfx'. ```APIDOC micro Wiki EN: - How micro work - SAPI Interface - INI Configuration - Section Settings - How to add an extension into micro.sfx ``` -------------------------------- ### micro Wiki CHS - Adding Extension Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Client Guide on how to add a PHP extension to the micro project, in Chinese. ```APIDOC micro How to Add Extension (CHS): Provides instructions on integrating custom PHP extensions into the micro project. ``` -------------------------------- ### Micro Wiki Documentation Links Source: https://docs.toast.run/swow-api/ci/Swow/IpAddressException Links to the micro Wiki documentation, available in both Chinese (CHS) and English (EN). These sections cover topics such as 'what is micro', 'how micro works', SAPI interfaces, INI configuration, section settings, and adding PHP extensions. ```APIDOC Micro Wiki CHS: - what-is-micro.html - how-micro-work.html - sapi-interface.html - ini-settings.html - sections.html - how-to-add-an-extension-into-micro.sfx.html Micro Wiki EN: - how-micro-work.html - sapi-interface.html - ini-settings.html - sections.html - how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### SwowHttpProtocolProtocolTypeTrait API Source: https://docs.toast.run/swow-api/ci/Swow/Http/Protocol/ProtocolTypeTrait This section details the Swow\Http\Protocol\ProtocolTypeTrait, including its properties and methods. It covers how to get the protocol type and how to handle upgrades. ```APIDOC Trait ProtocolTypeTrait Properties: protected $protocolType Methods: getProtocolType(): int Returns the protocol type. upgraded(int $protocolType): void Handles protocol upgrades. ``` -------------------------------- ### micro Wiki Documentation Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Config Links to the micro Wiki documentation, available in both Chinese (CHS) and English (EN), covering topics such as 'what is micro', 'how micro works', SAPI interface, INI configuration, section settings, and adding PHP extensions. ```MARKDOWN - micro Wiki CHS: - [micro是什么](https://docs.toast.run/micro/chs/what-is-micro.html) - [micro怎么工作](https://docs.toast.run/micro/chs/how-micro-work.html) - [SAPI接口](https://docs.toast.run/micro/chs/sapi-interface.html) - [INI配置](https://docs.toast.run/micro/chs/ini-settings.html) - [Section设置](https://docs.toast.run/micro/chs/sections.html) - [如何在micro中加入一个PHP扩展](https://docs.toast.run/micro/chs/how-to-add-an-extension-into-micro.sfx.html) - micro Wiki EN: - [How micro work](https://docs.toast.run/micro/en/how-micro-work.html) - [SAPI Interface](https://docs.toast.run/micro/en/sapi-interface.html) - [INI Configuration](https://docs.toast.run/micro/en/ini-settings.html) - [Section Settings](https://docs.toast.run/micro/en/sections.html) - [How to add an extension into micro.sfx](https://docs.toast.run/micro/en/how-to-add-an-extension-into-micro.sfx.html) ``` -------------------------------- ### micro Wiki EN Source: https://docs.toast.run/swow-api/ci/Swow/Signal Links to the English version of the micro Wiki, covering topics like 'How micro works', SAPI Interface, INI Configuration, Section Settings, and adding extensions. ```APIDOC micro Wiki EN: https://docs.toast.run/micro/en/ - How micro work: https://docs.toast.run/micro/en/how-micro-work.html - SAPI Interface: https://docs.toast.run/micro/en/sapi-interface.html - INI Configuration: https://docs.toast.run/micro/en/ini-settings.html - Section Settings: https://docs.toast.run/micro/en/sections.html - How to add an extension into micro.sfx: https://docs.toast.run/micro/en/how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### Swow Stream MaxMessageLengthTrait API Source: https://docs.toast.run/swow-api/ci/Swow/Stream/MaxMessageLengthTrait Documentation for the MaxMessageLengthTrait in Swow\Stream. This trait provides methods to get and set the maximum message length for stream-related operations. ```APIDOC Trait MaxMessageLengthTrait Properties: protected $maxMessageLength Methods: getMaxMessageLength(): int Returns the maximum message length. setMaxMessageLength(int $maxMessageLength): $this Sets the maximum message length. Accepts an integer value. ``` -------------------------------- ### Micro Wiki Documentation Links Source: https://docs.toast.run/swow-api/ci/Swow/Defer Links to the micro Wiki documentation, available in both Chinese (CHS) and English (EN). These sections cover topics such as 'what is micro', 'how micro works', SAPI interfaces, INI configuration, section settings, and adding extensions. ```APIDOC Micro Wiki CHS: what-is-micro.html how-micro-work.html sapi-interface.html ini-settings.html sections.html how-to-add-an-extension-into-micro.sfx.html Micro Wiki EN: how-micro-work.html sapi-interface.html ini-settings.html sections.html how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### Swow Error Handling Source: https://docs.toast.run/swow-api/ci/Swow/Errno Provides a static method to get a description of a Swow error code. This is useful for understanding and debugging errors within the Swow framework. ```APIDOC Swow\Errno::getDescriptionOf(int $error) - Retrieves the description string for a given Swow error code. - Parameters: - error: An integer representing the Swow error code. - Returns: - A string containing the description of the error. ``` ```PHP public static function getDescriptionOf ( int $error ) : string ``` -------------------------------- ### Micro Wiki Documentation Links Source: https://docs.toast.run/swow-api/ci/Swow/SyncException Links to the micro project's wiki, available in both Chinese (CHS) and English (EN). These wikis cover various aspects of micro, including its core concepts, working principles, SAPI interface, configuration, and extension management. ```APIDOC Micro Wiki CHS: what-is-micro.html how-micro-work.html sapi-interface.html ini-settings.html sections.html how-to-add-an-extension-into-micro.sfx.html Micro Wiki EN: how-micro-work.html sapi-interface.html ini-settings.html sections.html how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### Swow DebuggerDebugger Class API Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Server/BroadcastResult Documentation for the Swow\Debug\Debugger\Debugger class, the main class for controlling and interacting with the debugger. It allows starting, stopping, and controlling the debugging process. ```APIDOC Class Swow\Debug\Debugger\Debugger: __construct(Swow\Debug\Debugger\DebuggerIoInterface $io) Initializes the Debugger with an IO handler. start(): void Starts the debugging session. stop(): void Stops the debugging session. stepOver(): void Executes the next line, stepping over function calls. stepInto(): void Executes the next line, stepping into function calls. continueExecution(): void Continues execution until the next breakpoint or the end. ``` -------------------------------- ### micro Wiki EN - Adding Extension Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation on how to add an extension into micro.sfx within the micro Wiki (English). ```APIDOC How to add an extension into micro.sfx ``` -------------------------------- ### SwowPsr7MessageResponse Class Methods Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Message/Response This section details the methods available in the Swow\Psr7\Message\Response class, including getting and setting status codes and reason phrases, and converting the response to a string. ```APIDOC Class Swow\Psr7\Message\Response Properties: protected $reasonPhrase protected $statusCode Methods: getReasonPhrase(): string Returns the reason phrase for the HTTP response. getStatusCode(): int Returns the status code for the HTTP response. setStatus(int $code, string $reasonPhrase): static Sets the status code and reason phrase for the response. toString(bool $withoutBody): string Converts the response to a string representation, optionally without the body. withStatus(int $code, string $reasonPhrase): static Returns a new instance with the specified status code and reason phrase. ``` -------------------------------- ### SwowExtension API Documentation Source: https://docs.toast.run/swow-api/ci/Swow/Http/Http Details the Swow\Extension class, which is likely used for managing and interacting with Swow extensions. This could involve loading, unloading, or querying information about installed extensions. ```APIDOC Class Swow\Extension: Description: Manages and interacts with Swow extensions. Methods: - load(string $name): Loads a specified extension. - unload(string $name): Unloads a specified extension. - get(string $name): Retrieves information about an extension. ``` -------------------------------- ### micro Wiki EN - Section Settings Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation for Section Settings within the micro Wiki (English). ```APIDOC Section Settings ``` -------------------------------- ### micro Wiki Documentation Source: https://docs.toast.run/swow-api/ci/Swow/WatchdogException Links to the micro Wiki, available in both Chinese (CHS) and English (EN), covering various aspects of the micro framework, including its functionality, SAPI interface, configuration, and extension development. ```APIDOC micro Wiki CHS: - what-is-micro.html - how-micro-work.html - sapi-interface.html - ini-settings.html - sections.html - how-to-add-an-extension-into-micro.sfx.html micro Wiki EN: - how-micro-work.html - sapi-interface.html - ini-settings.html - sections.html - how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### Swow Core Functions Source: https://docs.toast.run/swow-api/ci/Swow Provides core utility functions for the Swow framework, including deferring tasks, getting stream file descriptors, querying processor counts, and creating pipes. ```APIDOC function defer ( callable $tasks ) : void Defer the execution of tasks. function fileno ( resource $stream ) : (int | null) Get the file descriptor of a stream. Param `resource` **$stream**: the stream to get the file descriptor of, must be a PHP stream resource. Throws `\Swow\Exception` when failed to get the file descriptor. function nproc ( int $kind ) : int Get the number of processors. Param `int` **$kind**: processors count kind, currently only support `Swow\NPROC_AVAILABLE` which means the number of available (i.e. online logical cores) processors. Throws `\Swow\Exception` when failed to get the number of processors. function pipe ( int $rflags = 0 , int $wflags = 0 ) : (array{0: resource, 1: resource} | null) Create a pipe pair. Param `int` **$rflags**: read end flags, default is `0`. Param `int` **$wflags**: write end flags, default is `0`. Returns `(array{0: resource, 1: resource} | null)`: the first element is the read end, the second element is the write end. Throws `\Swow\Exception` when failed to create pipe. function pipe_from_fd ( int $fd , string $mode ) : resource Create a pipe from a file descriptor. Param `int` **$fd**: the file descriptor to create a pipe from. Param `string` **$mode**: the mode of the pipe, must be `r` or `w`. Returns `resource`: the pipe resource. Throws `\Swow\Exception` when failed to create a pipe. ``` -------------------------------- ### Micro Wiki Documentation Links Source: https://docs.toast.run/swow-api/ci/Swow/CoroutineException Links to the micro Wiki documentation, available in both Chinese (CHS) and English (EN). These wikis cover topics such as the definition of micro, its working principles, SAPI interfaces, INI configuration, section settings, and how to add extensions. ```APIDOC micro Wiki CHS: what-is-micro how-micro-work sapi-interface ini-settings sections how-to-add-an-extension-into-micro.sfx micro Wiki EN: How micro work SAPI Interface INI Configuration Section Settings How to add an extension into micro.sfx ``` -------------------------------- ### Micro Wiki Documentation Source: https://docs.toast.run/swow-api/ci/Swow/Errno Links to the micro project's wiki, available in both Chinese (CHS) and English (EN). Covers topics such as 'what is micro', 'how micro works', SAPI interface, INI configuration, section settings, and adding extensions. ```APIDOC Micro Wiki CHS: what-is-micro.html how-micro-work.html sapi-interface.html ini-settings.html sections.html how-to-add-an-extension-into-micro.sfx.html Micro Wiki EN: how-micro-work.html sapi-interface.html ini-settings.html sections.html how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### micro Wiki CHS Documentation Source: https://docs.toast.run/swow-api/ci/Swow/SocketException Links to the Chinese version of the micro Wiki, covering topics like 'what is micro', 'how micro works', SAPI interfaces, INI configuration, section settings, and adding PHP extensions. ```APIDOC micro Wiki CHS: micro是什么: https://docs.toast.run/micro/chs/what-is-micro.html micro怎么工作: https://docs.toast.run/micro/chs/how-micro-work.html SAPI接口: https://docs.toast.run/micro/chs/sapi-interface.html INI配置: https://docs.toast.run/micro/chs/ini-settings.html Section设置: https://docs.toast.run/micro/chs/sections.html 如何在micro中加入一个PHP扩展: https://docs.toast.run/micro/chs/how-to-add-an-extension-into-micro.sfx.html ``` -------------------------------- ### Swow API Namespace and Class Overview Source: https://docs.toast.run/swow-api/ci/Swow/Pack This section outlines the structure of the Swow API, listing key namespaces and their associated classes. It serves as a navigation guide to the different components of the Swow library. ```APIDOC Namespace Swow\Stream: Class Swow\Stream\VarStream Trait Swow\Stream\MaxMessageLengthTrait Namespace Swow\Sync: Class Swow\Sync\WaitGroup Class Swow\Sync\WaitReference Namespace Swow\Utils: Class Swow\Utils\Handler Namespace Swow\WebSocket: Class Swow\WebSocket\Header Class Swow\WebSocket\Opcode Class Swow\WebSocket\Status Class Swow\WebSocket\WebSocket Namespace Swow: Class Swow ``` -------------------------------- ### micro Wiki EN - SAPI Interface Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation for the SAPI Interface within the micro Wiki (English). ```APIDOC SAPI Interface ``` -------------------------------- ### Swow Watchdog Class API Source: https://docs.toast.run/swow-api/ci/Swow/Errno Documentation for the Swow\Watchdog class, which is likely used for implementing watchdog timers or monitoring system health. It may provide methods for starting, stopping, and resetting timers. ```APIDOC Class Swow\Watchdog __construct(int $timeout) Constructs a Watchdog timer with a specified timeout. Parameters: - timeout: The timeout duration in seconds. start(): bool Starts the watchdog timer. Returns: true on success, false on failure. reset(): bool Resets the watchdog timer. Returns: true on success, false on failure. stop(): bool Stops the watchdog timer. Returns: true on success, false on failure. ``` -------------------------------- ### micro Wiki EN - INI Configuration Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation for INI Configuration within the micro Wiki (English). ```APIDOC INI Configuration ``` -------------------------------- ### Swow Psr17FactoryTrait Example Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Message/ServerPsr17FactoryTrait This snippet demonstrates the usage of the ServerPsr17FactoryTrait within the Swow project. It is part of the Psr7 Message implementation, likely used for creating PSR-7 compliant HTTP messages on the server-side. ```PHP use Swow\Psr7\Message\ServerPsr17FactoryTrait; class MyServerFactory { use ServerPsr17FactoryTrait; // ... other methods ... } ``` -------------------------------- ### micro Wiki EN - SAPI Interface Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Client Documentation regarding the SAPI (Server API) interface within the micro project, in English. ```APIDOC micro SAPI Interface (EN): Describes the Server API interface for the micro project. ``` -------------------------------- ### Micro Wiki CHS Documentation Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Server This provides links to the micro Wiki documentation in Chinese, covering topics such as 'what is micro', 'how micro works', SAPI interfaces, INI configuration, section settings, and how to add a PHP extension. ```APIDOC micro Wiki CHS: - micro是什么 - micro怎么工作 - SAPI接口 - INI配置 - Section设置 - 如何在micro中加入一个PHP扩展 ``` -------------------------------- ### micro Wiki EN - Section Settings Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Client Documentation on section settings within the micro project, in English. ```APIDOC micro Section Settings (EN): Explains how to configure and use sections within the micro project. ``` -------------------------------- ### Swow Psr7 Utils FactoryTrait API Documentation Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Utils/FactoryTrait Provides static methods to get and set default factory implementations for PSR-7 related components like UploadedFileFactory, UriFactory, RequestFactory, ResponseFactory, ServerConnectionFactory, and ServerRequestFactory. ```APIDOC FactoryTrait: getDefaultUploadedFileFactory(): UploadedFileFactoryInterface Retrieves the default UploadedFileFactory. getDefaultUriFactory(): UriFactoryInterface Retrieves the default UriFactory. setDefaultRequestFactory(RequestFactoryInterface $requestFactory): void Sets the default RequestFactory. Parameters: - requestFactory: The RequestFactoryInterface instance to set. setDefaultResponseFactory(ResponseFactoryInterface $responseFactory): void Sets the default ResponseFactory. Parameters: - responseFactory: The ResponseFactoryInterface instance to set. setDefaultServerConnectionFactory(ServerConnectionFactoryInterface $serverConnectionFactory): void Sets the default ServerConnectionFactory. Parameters: - serverConnectionFactory: The ServerConnectionFactoryInterface instance to set. setDefaultServerRequestFactory(ServerRequestFactoryInterface $serverRequestFactory): void Sets the default ServerRequestFactory. Parameters: - serverRequestFactory: The ServerRequestFactoryInterface instance to set. setDefaultStreamFactory(StreamFactoryInterface $streamFactory): void Sets the default StreamFactory. Parameters: - streamFactory: The StreamFactoryInterface instance to set. setDefaultUploadedFileFactory(UploadedFileFactoryInterface $uploadedFileFactory): void Sets the default UploadedFileFactory. Parameters: - uploadedFileFactory: The UploadedFileFactoryInterface instance to set. setDefaultUriFactory(UriFactoryInterface $uriFactory): void Sets the default UriFactory. Parameters: - uriFactory: The UriFactoryInterface instance to set. ``` -------------------------------- ### Swow API EventDriver Methods Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Server/EventDriver Provides methods to configure event handlers for the Swow API server's event driver. `withRequestHandler` sets a callback for processing incoming server requests, while `withStartHandler` defines a callback executed when the server starts. ```APIDOC EventDriver: withRequestHandler(callable(ServerConnection, ServerRequestPlusInterface): mixed $handler): static Sets a handler for processing server requests. Parameters: $handler: A callable that accepts a ServerConnection and a ServerRequestPlusInterface, returning mixed. withStartHandler(callable(Server): void $handler): static Sets a handler to be executed when the server starts. Parameters: $handler: A callable that accepts a Server instance and returns void. ``` -------------------------------- ### micro Wiki EN - INI Configuration Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Client Documentation on INI configuration settings for the micro project, in English. ```APIDOC micro INI Configuration (EN): Details the INI configuration options available for the micro project. ``` -------------------------------- ### Swow Socket Global Timeout Management Source: https://docs.toast.run/swow-api/ci/Swow/Socket Provides static methods to get and set global timeout values for socket operations like read, write, accept, connect, and DNS resolution. These methods allow for centralized control over network operation timeouts within the Swow framework. ```APIDOC Swow\Socket::getGlobalReadTimeout ( ) : int Retrieves the global read timeout setting. Swow\Socket::getGlobalWriteTimeout ( ) : int Retrieves the global write timeout setting. Swow\Socket::setGlobalAcceptTimeout ( int $timeout ) : void Sets the global accept timeout for new connections. Parameters: $timeout: The timeout value in seconds. Swow\Socket::setGlobalConnectTimeout ( int $timeout ) : void Sets the global connect timeout for establishing new connections. Parameters: $timeout: The timeout value in seconds. Swow\Socket::setGlobalDnsTimeout ( int $timeout ) : void Sets the global DNS resolution timeout. Parameters: $timeout: The timeout value in seconds. Swow\Socket::setGlobalHandshakeTimeout ( int $timeout ) : void Sets the global handshake timeout for secure connections. Parameters: $timeout: The timeout value in seconds. Swow\Socket::setGlobalReadTimeout ( int $timeout ) : void Sets the global read timeout for data reception. Parameters: $timeout: The timeout value in seconds. Swow\Socket::setGlobalTimeout ( int $timeout ) : void Sets a general global timeout that may apply to various operations. Parameters: $timeout: The timeout value in seconds. Swow\Socket::setGlobalWriteTimeout ( int $timeout ) : void Sets the global write timeout for data transmission. Parameters: $timeout: The timeout value in seconds. ``` -------------------------------- ### About Page Source: https://docs.toast.run/swow-api/ci/Swow/Signal Link to the About page. ```APIDOC About: https://docs.toast.run/about/ ``` -------------------------------- ### Swow Coroutine Trace Methods Source: https://docs.toast.run/swow-api/ci/Swow/Coroutine Provides methods to retrieve trace information for coroutines in various formats. Includes getting detailed trace data, trace as a list of strings, trace as a single string, and the depth of the trace. These methods are useful for debugging and understanding coroutine execution flow. ```APIDOC Coroutine::getTrace(int $level, int $limit, int $options): array, class?: string}> Retrieves detailed trace information for a coroutine. - `$level`: Specifies the frame level for tracing. Positive values count from the current frame upwards, negative values count from the top. - `$limit`: Sets the maximum number of frames to trace. A negative or zero value means no limit. - `$options`: Trace options, similar to `debug_backtrace` options. Coroutine::getTraceAsList(int $level, int $limit, int $options): array Retrieves trace information as an array of strings, mimicking the original PHP stack trace format. - Parameters are the same as `Coroutine::getTrace()`. Coroutine::getTraceAsString(int $level, int $limit, int $options): string Retrieves trace information as a single string, formatted like the original PHP stack trace. - Parameters are the same as `Coroutine::getTrace()`. Coroutine::getTraceDepth(int $limit): int Retrieves the depth of the coroutine's trace. - `$limit`: Specifies the limit for trace depth calculation. - See `Coroutine::getTrace()` for parameter usage. ``` -------------------------------- ### Swow Buffer Class Methods Source: https://docs.toast.run/swow-api/ci/Swow/Buffer This section details various methods available for the Swow Buffer class, including operations for duplicating strings, extending buffer capacity, fetching string representations, managing available and total sizes, retrieving lock objects, checking buffer states (available, empty, full, locked), performing buffer locking and unlocking, memory trimming, preparing buffer space, reading data with specified ranges, reallocating buffer size, converting buffer to string, truncating buffer content from the start or at an offset, and writing string data with offset and length specifications. ```APIDOC Buffer Class Methods: dupString(): string Duplicates the buffer's string content. extend(int $recommendSize = $this->getSize() * 2): void Extends the buffer's capacity with a recommended size. fetchString(): string Fetches the buffer's content as a string. getAvailableSize(): int Retrieves the amount of available space in the buffer. getLength(): int Gets the current length of data in the buffer. getLocker(): Coroutine Returns the coroutine locker associated with the buffer. getSize(): int Gets the total size (capacity) of the buffer. isAvailable(): bool Checks if the buffer is available for operations. isEmpty(): bool Checks if the buffer is empty. isFull(): bool Checks if the buffer is full. isLocked(): bool Checks if the buffer is currently locked. lock(): void Locks the buffer for exclusive access. mallocTrim(): void Trims unused memory from the buffer. prepare(int $appendLength): void Prepares the buffer to append a specified length of data. read(int $start, int $length): string Reads data from the buffer within a specified range. Parameters: - start: The starting position for reading. - length: The number of bytes to read. Returns: The data read as a string. Throws: \ValueError if specified $start and $length are out of range. realloc(int $size): void Reallocates the buffer to a new size. toString(): string Converts the buffer's content to a string. truncate(int $length): int Truncates the buffer to a specified length. Returns: The length of the buffer after truncation. truncateFrom(int $offset = $this->getOffset(), int $length): int Truncates the buffer starting from a specified offset. Parameters: - offset: The offset from which to truncate (defaults to current offset). Returns: The length of the buffer after truncation. tryLock(): bool Attempts to lock the buffer without blocking. Returns: True if the lock was acquired, false otherwise. unlock(): void Unlocks the buffer. write(int $offset, Stringable|string $string, int $start, int $length): int Writes string data to the buffer at a specified offset. Parameters: - offset: The offset in the buffer to write to. - string: The string data to write. - start: The starting position within the input string. - length: The number of bytes to write from the input string. Returns: The number of bytes written. Throws: \ValueError if specified $start, $offset, or $length are out of range. ``` -------------------------------- ### Swow API Reference (ci) Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Config Provides an overview of the Swow API, including namespaces like Swow\Stream, Swow\Sync, Swow\Utils, and Swow\WebSocket. It links to detailed documentation for classes and traits within these namespaces. ```APIDOC Swow API Reference (ci): - Namespace Swow\Stream: - Class Swow\Stream\VarStream - Trait Swow\Stream\MaxMessageLengthTrait - Namespace Swow\Sync: - Class Swow\Sync\WaitGroup - Class Swow\Sync\WaitReference - Namespace Swow\Utils: - Class Swow\Utils\Handler - Namespace Swow\WebSocket: - Class Swow\WebSocket\Header - Class Swow\WebSocket\Opcode - Class Swow\WebSocket\Status - Class Swow\WebSocket\WebSocket - Namespace \Swow: - Class \Swow ``` -------------------------------- ### Swow API Reference Overview Source: https://docs.toast.run/swow-api/ci/Swow/Psr7 Provides an overview of the Swow API, listing key namespaces and classes available for use. This includes stream handling, synchronization primitives, utility functions, WebSocket implementation, and PSR-7 compatibility. ```APIDOC Swow API Reference (ci): https://docs.toast.run/swow-api/ci.html Namespaces and Classes: - Swow\Stream\VarStream - Swow\Stream\MaxMessageLengthTrait - Swow\Sync\WaitGroup - Swow\Sync\WaitReference - Swow\Utils\Handler - Swow\WebSocket\Header - Swow\WebSocket\Opcode - Swow\WebSocket\Status - Swow\WebSocket\WebSocket - Swow - Swow\Psr7\Psr7 ``` -------------------------------- ### Swow PSR-7 Server Classes and Interfaces Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Config Documentation for classes and interfaces related to the Swow PSR-7 server implementation, including server management, connection handling, and event drivers. ```APIDOC Swow\Psr7\Server\BroadcastResult: Represents the result of a broadcast operation. Swow\Psr7\Server\EventDriver: Manages server events. Swow\Psr7\Server\FilteredServerConnectionIterator: An iterator for filtering server connections. Swow\Psr7\Server\Server: The main server class. Swow\Psr7\Server\ServerConnection: Represents a connection to the server. Swow\Psr7\Server\ServerConnectionIterator: An iterator for server connections. Swow\Psr7\Server\ServerConnectionFactoryInterface: Interface for creating server connections. Swow\Psr7\Server\ServerConnectionIteratorInterface: Interface for iterating server connections. ``` -------------------------------- ### Swow PSR-7 Server Traits Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation for traits within the SwowPsr7Server namespace, providing reusable logic for server connection management and parameter handling. ```APIDOC Trait Swow\Psr7\Server\ServerConnectionFactoryTrait Trait Swow\Psr7\Server\ServerConnectionManagerTrait Trait Swow\Psr7\Server\ServerParamsTrait ``` -------------------------------- ### Swow API Reference Overview Source: https://docs.toast.run/swow-api/ci/Swow/SocketException Provides an overview of the Swow API, including links to different namespaces and classes. ```APIDOC Swow API Reference (ci): https://docs.toast.run/swow-api/ci.html Namespace Swow: https://docs.toast.run/swow-api/ci/Swow/ Class Swow\SocketException: https://docs.toast.run/swow-api/ci/Swow/SocketException.html ``` -------------------------------- ### Swow PSR-7 Server Classes and Interfaces Source: https://docs.toast.run/swow-api/ci/Swow/Debug/Debugger/DebuggerSourceMapTrait Documentation for classes and interfaces related to the Swow PSR-7 server implementation, including server management, connection handling, and event drivers. ```APIDOC Swow\Psr7\Server\BroadcastResult: Represents the result of a broadcast operation. Swow\Psr7\Server\EventDriver: Manages server events. Swow\Psr7\Server\FilteredServerConnectionIterator: An iterator for filtering server connections. Swow\Psr7\Server\Server: The main server class. Swow\Psr7\Server\ServerConnection: Represents a connection to the server. Swow\Psr7\Server\ServerConnectionIterator: An iterator for server connections. Swow\Psr7\Server\ServerConnectionFactoryInterface: Interface for creating server connections. Swow\Psr7\Server\ServerConnectionIteratorInterface: Interface for iterating server connections. ``` -------------------------------- ### About Page Link Source: https://docs.toast.run/swow-api/ci/Swow/SocketException A link to the 'About' page of the documentation. ```APIDOC About: https://docs.toast.run/about/ ``` -------------------------------- ### Just the Docs Theme Source: https://docs.toast.run/swow-api/ci/Swow/Signal Information about the documentation theme used on the site. ```APIDOC This site uses Just the Docs: https://github.com/just-the-docs/just-the-docs ``` -------------------------------- ### Swow PSR-7 Server Classes and Interfaces Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Psr7 Documentation for classes and interfaces related to the Swow PSR-7 server implementation, including server management, connection handling, and event drivers. ```APIDOC Swow\Psr7\Server\BroadcastResult: Represents the result of a broadcast operation. Swow\Psr7\Server\EventDriver: Manages server events. Swow\Psr7\Server\FilteredServerConnectionIterator: An iterator for filtering server connections. Swow\Psr7\Server\Server: The main server class. Swow\Psr7\Server\ServerConnection: Represents a connection to the server. Swow\Psr7\Server\ServerConnectionIterator: An iterator for server connections. Swow\Psr7\Server\ServerConnectionFactoryInterface: Interface for creating server connections. Swow\Psr7\Server\ServerConnectionIteratorInterface: Interface for iterating server connections. ``` -------------------------------- ### Swow Core API Documentation Source: https://docs.toast.run/swow-api/develop Documentation for the core Swow class. ```APIDOC Class Swow ``` -------------------------------- ### Swow PSR-7 Server Classes and Interfaces Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Server Documentation for classes and interfaces within the SwowPsr7Server namespace, managing server connections, event drivers, and broadcast results. ```APIDOC Class Swow\Psr7\Server\BroadcastResult Class Swow\Psr7\Server\EventDriver Class Swow\Psr7\Server\FilteredServerConnectionIterator Class Swow\Psr7\Server\Server Class Swow\Psr7\Server\ServerConnection Class Swow\Psr7\Server\ServerConnectionIterator Interface Swow\Psr7\Server\ServerConnectionFactoryInterface Interface Swow\Psr7\Server\ServerConnectionIteratorInterface ``` -------------------------------- ### Swow API Reference Documentation Source: https://docs.toast.run/swow-api/ci/Swow/WatchdogException This section details the Swow API, covering various namespaces and classes. It includes information on Coroutines, Sockets, Buffers, Exceptions, and debugging tools. The documentation is organized by namespace and class for easy navigation. ```APIDOC Namespace Swow: Class Swow\Buffer Class Swow\BufferException Class Swow\CallException Class Swow\Channel Class Swow\ChannelException Class Swow\Coroutine Class Swow\CoroutineException Class Swow\Defer Class Swow\Errno Class Swow\Exception Class Swow\Extension Class Swow\IpAddress Class Swow\IpAddressException Class Swow\Library Class Swow\Log Class Swow\Selector Class Swow\SelectorException Class Swow\Signal Class Swow\SignalException Class Swow\Socket Class Swow\SocketException Class Swow\SyncException Class Swow\Watchdog Class Swow\WatchdogException Namespace Swow\Context: Class Swow\Context\Context Class Swow\Context\CoroutineContext Namespace Swow\Debug: Namespace Swow\Debug\Debugger: Class Swow\Debug\Debugger\DebugContext Class Swow\Debug\Debugger\Debugger Class Swow\Debug\Debugger\DebuggerCommandContext Class Swow\Debug\Debugger\DebuggerException Class Swow\Debug\Debugger\DebuggerHelper Class Swow\Debug\Debugger\DebuggerIoEofStream Class Swow\Debug\Debugger\DebuggerIoStdIO Interface Swow\Debug\Debugger\DebuggerIoInterface ``` -------------------------------- ### Swow API Namespace and Class Overview Source: https://docs.toast.run/swow-api/ci/Swow/Psr7/Psr7 This section outlines the structure of the Swow API, listing key namespaces and classes available for use. It includes links to detailed documentation for each component, such as streams, synchronization utilities, and WebSocket implementations. ```APIDOC Swow API Reference (ci): https://docs.toast.run/swow-api/ci.html Namespaces: Swow\Stream: https://docs.toast.run/swow-api/ci/Swow/Stream/ - Class Swow\Stream\VarStream - Trait Swow\Stream\MaxMessageLengthTrait Swow\Sync: https://docs.toast.run/swow-api/ci/Swow/Sync/ - Class Swow\Sync\WaitGroup - Class Swow\Sync\WaitReference Swow\Utils: https://docs.toast.run/swow-api/ci/Swow/Utils/ - Class Swow\Utils\Handler Swow\WebSocket: https://docs.toast.run/swow-api/ci/Swow/WebSocket/ - Class Swow\WebSocket\Header - Class Swow\WebSocket\Opcode - Class Swow\WebSocket\Status - Class Swow\WebSocket\WebSocket (Root Namespace): https://docs.toast.run/swow-api/ci/ - Class Swow Swow\Psr7 Namespace: https://docs.toast.run/swow-api/ci/Swow/Psr7/ - Class Swow\Psr7\Psr7 ``` -------------------------------- ### Swow PSR-7 Server Traits Source: https://docs.toast.run/swow-api/ci/Swow/Debug/Debugger/DebuggerSourceMapTrait Documentation for traits providing server connection management and parameter handling within the Swow PSR-7 server implementation. ```APIDOC Swow\Psr7\Server\ServerConnectionFactoryTrait: Provides server connection factory methods. Swow\Psr7\Server\ServerConnectionManagerTrait: Provides methods for managing server connections. Swow\Psr7\Server\ServerParamsTrait: Provides methods for accessing server parameters. ``` -------------------------------- ### Swow PSR-7 Utils Traits Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation for traits within the SwowPsr7Utils namespace, offering utility functions for conversion, creation, detection, and operation. ```APIDOC Trait Swow\Psr7\Utils\ConverterTrait Trait Swow\Psr7\Utils\CreatorTrait Trait Swow\Psr7\Utils\DetectorTrait Trait Swow\Psr7\Utils\FactoryTrait Trait Swow\Psr7\Utils\OperatorTrait ``` -------------------------------- ### Swow PSR-7 Server Classes Source: https://docs.toast.run/swow-api/ci/Swow/WatchdogException Documentation for classes within the SwowPsr7Server namespace, related to server functionalities, connections, and event handling. ```APIDOC Class Swow\Psr7\Server\BroadcastResult Class Swow\Psr7\Server\EventDriver Class Swow\Psr7\Server\FilteredServerConnectionIterator Class Swow\Psr7\Server\Server Class Swow\Psr7\Server\ServerConnection Class Swow\Psr7\Server\ServerConnectionIterator ``` -------------------------------- ### Swow PSR-7 Server Interfaces Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation for interfaces within the SwowPsr7Server namespace, defining contracts for server connection factories and iterators. ```APIDOC Interface Swow\Psr7\Server\ServerConnectionFactoryInterface Interface Swow\Psr7\Server\ServerConnectionIteratorInterface ``` -------------------------------- ### micro Wiki CHS - Adding Extension Source: https://docs.toast.run/swow-api/ci/Swow/BufferException Documentation on how to add a PHP extension into micro.sfx within the micro Wiki (Chinese). ```APIDOC 如何在micro中加入一个PHP扩展 ```