Cookies

Cookies are small pieces of data stored on the client and sent with each HTTP request. They are commonly used for session management, personalization, and tracking.

Centum provides convenient classes for working with cookies in your application.

Centum\Http\Cookie

Represents a single HTTP cookie.

Centum\Http\Cookie(
    string $name,
    string $value
);

Centum\Http\Cookie implements Centum\Interfaces\Http\CookieInterface.

Centum\Http\Cookies

Represents a collection of cookies.

Centum\Http\Cookies implements Centum\Interfaces\Http\CookiesInterface.

Cookies Factory

You can obtain a Cookies object made with global variables using CookiesFactory:

use Centum\Http\CookiesFactory;

$cookiesFactory = new CookiesFactory();

$cookies = $cookiesFactory->createFromGlobals();

// $cookies now contains all cookies sent by the client