OpenSwoole\Http\Request->cookie

25.x is outdated, please check the latest version 26.x


Latest version: pecl install openswoole-26.2.0

Declaration

<?php OpenSwoole\Http\Request->cookie: array

Parameters

None

Return

Array

Description

The OpenSwoole\Http\Request->cookie class property is an array which contains HTTP request cookie data. It is a key-value array and is equivalent to the PHP super global variable $_COOKIE.

All the array keys are lowercase.

Example

<?php

$server->on('Request', function(OpenSwoole\Server\Request $request, OpenSwoole\Server\Response $response)
{
    echo $request->cookie['username'];

    // See the whole cookie array
    var_dump($request->cookie);
});
Last updated on February 28, 2026