# Constructor

Learn how to initialize an array content provider.

The constructor initializes the provider with a versioned, localized content map that mirrors the [`slots.json` file](/reference/cli/fallback-content) the CLI generates.

For each lookup, the provider serves the latest version and resolves the requested language, falling back to the default locale.

## Signature

The constructor has the following signature:

```php
public function __construct(array $slots, ?string $defaultLocale = null)
```

## Example

Here is a basic example of how to initialize an array content provider:

```php
<?php
use Croct\Plug\Content\ArrayContentProvider;

$provider = new ArrayContentProvider(
    slots: [
        'home-banner' => [
            [
                'version' => 1,
                'content' => [
                    'en' => ['title' => 'Welcome to Croct!'],
                ],
            ],
        ],
    ],
    defaultLocale: 'en',
);
```

## Parameters

The following list describes the supported parameters:

- `slots`: `array<string, array>`

  The versioned content of each slot, keyed by slot ID. Each value is a list of version entries, and malformed entries are skipped.

  - `version`: `integer`

    The content version. The highest available is served.

  - `content`: `array<string, array<string, mixed>>`

    The slot's content for each locale, keyed by locale code.

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

  The locale served when no language is requested or the requested one is unavailable. The default is `null`, which serves nothing in those cases.
