# Constructor

Learn how to initialize a cookie configuration.

The constructor initializes the cookie configuration with the settings you provide.

Every parameter is optional, so you can override only the settings you need and keep the defaults for the rest.

## Signature

The constructor has the following signature:

```php
public function __construct(
    string $clientIdName = 'ct_client_id',
    string $userTokenName = 'ct_user_token',
    int $clientIdDuration = 31536000,
    int $userTokenDuration = 604800,
    ?string $domain = null,
    bool $secure = true,
    string $sameSite = 'None',
)
```

## Example

Here is a basic example of how to initialize a cookie configuration:

```php
<?php
use Croct\Plug\CookieConfiguration;

$configuration = new CookieConfiguration(
    domain: 'example.com',
    sameSite: 'Lax',
);
```

## Parameters

The following list describes the supported parameters:

- `clientIdName`: `string` (optional) (default: ct\_client\_id)

  The name of the client ID cookie.

- `userTokenName`: `string` (optional) (default: ct\_user\_token)

  The name of the user token cookie.

- `clientIdDuration`: `integer` (optional) (default: 31536000)

  The lifetime of the client ID cookie, in seconds. The default is `31536000` seconds, which is one year.

- `userTokenDuration`: `integer` (optional) (default: 604800)

  The lifetime of the user token cookie, in seconds. The default is `604800` seconds, which is one week.

- `domain`: `string|null` (optional) (default: null)

  The domain for the cookies. The default is `null`, which scopes the cookies to the current host.

- `secure`: `boolean` (optional) (default: true)

  Whether the cookies are sent only over HTTPS.

- `sameSite`: `string` (optional) (default: None)

  The SameSite policy applied to the cookies.
