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.
Overview
Articles are the primary legal content of each framework. Every article belongs to exactly one framework, identified by its slug. Use $client->articles to list, fetch, and navigate them.
Methods
list()
Returns a page of article summaries for the given framework.
$page = $client->articles->list('gdpr', page: 1, perPage: 20);
printf("GDPR has %d articles\n", $page->meta->total);
foreach ($page->data as $article) {
printf(" Art. %s: %s\n", $article->articleNumber, $article->title);
}
Parameters
| Parameter | Type | Default | Description |
|---|
$frameworkSlug | string | required | Framework slug, e.g. 'gdpr' |
$page | int|null | null | Page number |
$perPage | int|null | null | Items per page (1–100) |
Returns Page<ArticleSummary>
get()
Fetch the full content of a single article, including all paragraphs.
$article = $client->articles->get('gdpr', 17);
echo $article->title . "\n";
echo $article->content . "\n";
foreach ($article->paragraphs as $para) {
printf(" §%s: %s\n", $para->paragraphRef, $para->content);
}
Parameters
| Parameter | Type | Description |
|---|
$frameworkSlug | string | Framework slug |
$articleNumber | int|string | Article number within the framework |
Returns Article
Fetch articles related to a given article.
$page = $client->articles->related('gdpr', 17);
foreach ($page->data as $article) {
printf(" Related: Art. %s — %s\n", $article->articleNumber, $article->title);
}
Returns Page<ArticleSummary>
iter()
Iterate over all articles in a framework across all pages.
foreach ($client->articles->iter('gdpr') as $article) {
printf("Art. %s: %s\n", $article->articleNumber, $article->title);
}
Returns \Generator<ArticleSummary>
Models
ArticleSummary
Returned by list(), related(), and iter().
| Field | Type | Description |
|---|
id | int | Internal numeric ID |
frameworkSlug | string | Parent framework slug |
articleNumber | string | Article number within the framework |
title | string | Article heading |
position | int | Ordering position in the framework |
paragraphCount | int | Number of paragraphs |
tags | Tag[] | Tags applied to this article |
Article
Returned by get(). Extends ArticleSummary with:
| Field | Type | Description |
|---|
content | string | Full plain-text content of the article |
paragraphs | ArticleParagraph[] | Ordered list of paragraph objects |
ArticleParagraph
| Field | Type | Description |
|---|
paragraphRef | string | Label, e.g. '1', '2a', 'intro' |
content | string | Paragraph text |
position | int | Ordering position within the article |
Examples
Print every GDPR article
foreach ($client->articles->iter('gdpr') as $article) {
printf("Art. %3s %s\n", $article->articleNumber, $article->title ?: '(untitled)');
}
Fetch a specific article and display paragraphs
$article = $client->articles->get('gdpr', 17);
echo "Article {$article->articleNumber}: {$article->title}\n";
echo str_repeat('=', 60) . "\n";
foreach ($article->paragraphs as $para) {
echo "\n({$para->paragraphRef}) {$para->content}\n";
}
Collect all articles into an array for fast lookup
$byNumber = [];
foreach ($client->articles->iter('cra') as $article) {
$byNumber[$article->articleNumber] = $article;
}
echo $byNumber['10']->title . "\n";
Use iter() when you need every article. Use list() when you only need one page or want to control pagination yourself.