REST
Less than 1 minute
REST
HTTP REST client for communicating with a Warlock server endpoint.
class RESTProperties
serverConfig
Merged server/client/admin configuration for REST interactions.
public Config $serverConfigclient
HTTP client used to send protocol payloads.
private Client $clientprotocol
Packet protocol encoder for request bodies.
private Protocol $protocolMethods
__construct
public __construct(array $serverConfig): voidParameters
| Parameter | Type | Description |
|---|---|---|
$serverConfig | array | override configuration values |
trigger
Triggers an event and sends the corresponding data.
public trigger(string $event, mixed $data, mixed $options, ?Response $response): boolParameters
| Parameter | Type | Description |
|---|---|---|
$event | string | the event identifier |
$data | mixed | The data to be sent with the event. Default is null. |
$options | mixed | Additional options for the event. Default is null. |
$response | Response |
send
Sends a request to the configured server.
private send(PacketType $type, mixed $data, mixed $options, ?Response $response): boolThis method constructs a URL based on the server configuration and sends a POST request with the specified type and data. It handles cases where the client server or port is not specified by defaulting to the server's listen address and port. Additionally, it sets up the authorization header if an admin key is provided.
Parameters
| Parameter | Type | Description |
|---|---|---|
$type | PacketType | the type of the request |
$data | mixed | The data to be sent with the request. Default is null. |
$options | mixed | Additional options for the request. Default is null. |
$response | Response |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000