# Constructor

Learn how to initialize slot metadata directly.

The constructor initializes the slot metadata.

You normally read it from the [fetch response](../fetch-response/get-metadata) instead, but you can construct it directly to provide fixed metadata in tests.

## Signature

The constructor has the following signature:

```php
public function __construct(
    string $version,
    ContentSource $contentSource,
    ?ExperienceMetadata $experience = null,
    ?array $schema = null,
)
```

## Example

Here is a basic example of how to initialize slot metadata:

```php
<?php
use Croct\Plug\Content\ContentSource;
use Croct\Plug\Content\SlotMetadata;

$metadata = new SlotMetadata(
    version: '1',
    contentSource: ContentSource::EXPERIMENT,
);
```

## Parameters

The following list describes the supported parameters:

- `version`: `string`

  The content version.

- `contentSource`: [`ContentSource`](/reference/sdk/php/api/response/content-source)

  The source the content was served from.

- `experience`: `ExperienceMetadata|null` (optional) (default: null) (see [ExperienceMetadata](/reference/sdk/php/api/response/experience-metadata))

  The experience that served the content. The default is `null`, which means no experience applies.

- `schema`: `array<string, mixed>|null` (optional) (default: null)

  The [content schema](/reference/content/schema/introduction). The default is `null`, which means no schema is included.
