> ## Documentation Index
> Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# Requirements

> Fetch extracted compliance requirements with the Law4Devs PHP SDK.

## Overview

Requirements are structured compliance obligations extracted from regulatory articles. Each requirement has a type, optional deadline, linked articles, and stakeholder roles. Use `$client->requirements` to access them.

***

## Methods

### `list()`

Returns a page of requirements for the given framework.

```php theme={null}
$page = $client->requirements->list('cra', perPage: 20);

printf("CRA has %d requirements\n", $page->meta->total);
foreach ($page->data as $req) {
    printf("  [%s] %s\n", $req->requirementType, substr($req->requirementText, 0, 80));
}
```

**Returns** `Page<Requirement>`

***

### `get()`

Fetch a single requirement by ID.

```php theme={null}
$req = $client->requirements->get('cra', 42);
echo $req->requirementText . "\n";
```

**Returns** `Requirement`

***

### `iter()`

Iterate over all requirements in a framework.

```php theme={null}
foreach ($client->requirements->iter('gdpr') as $req) {
    echo $req->requirementType . ': ' . substr($req->requirementText, 0, 60) . "\n";
}
```

**Returns** `\Generator<Requirement>`

***

## Model

### `Requirement`

| Field                  | Type           | Description                                    |
| ---------------------- | -------------- | ---------------------------------------------- |
| `id`                   | `int`          | Internal numeric ID                            |
| `frameworkSlug`        | `string`       | Parent framework slug                          |
| `articleNumber`        | `int\|null`    | Source article number                          |
| `paragraphRef`         | `string\|null` | Paragraph reference within the article         |
| `paragraphContent`     | `string\|null` | Text of the source paragraph                   |
| `requirementText`      | `string`       | The extracted requirement                      |
| `requirementType`      | `string`       | Category, e.g. `'obligation'`, `'prohibition'` |
| `complianceDeadline`   | `string\|null` | Deadline date (ISO 8601) if specified          |
| `linkedArticleNumbers` | `int[]`        | Related article numbers                        |
| `stakeholderRoles`     | `string[]`     | Affected parties, e.g. `'manufacturer'`        |
| `tags`                 | `Tag[]`        | Tags applied to this requirement               |
| `createdAt`            | `string`       | ISO 8601 creation timestamp                    |

***

## Examples

### Filter by requirement type

```php theme={null}
foreach ($client->requirements->iter('cra') as $req) {
    if ($req->requirementType === 'obligation') {
        echo '- ' . $req->requirementText . "\n";
    }
}
```

### Find requirements with deadlines

```php theme={null}
foreach ($client->requirements->iter('nis2') as $req) {
    if ($req->complianceDeadline !== null) {
        printf("[%s] %s\n", $req->complianceDeadline, substr($req->requirementText, 0, 80));
    }
}
```
