Skip to main content

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
ParameterTypeDefaultDescription
$frameworkSlugstringrequiredFramework slug, e.g. 'gdpr'
$pageint|nullnullPage number
$perPageint|nullnullItems 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
ParameterTypeDescription
$frameworkSlugstringFramework slug
$articleNumberint|stringArticle 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().
FieldTypeDescription
idintInternal numeric ID
frameworkSlugstringParent framework slug
articleNumberstringArticle number within the framework
titlestringArticle heading
positionintOrdering position in the framework
paragraphCountintNumber of paragraphs
tagsTag[]Tags applied to this article

Article

Returned by get(). Extends ArticleSummary with:
FieldTypeDescription
contentstringFull plain-text content of the article
paragraphsArticleParagraph[]Ordered list of paragraph objects

ArticleParagraph

FieldTypeDescription
paragraphRefstringLabel, e.g. '1', '2a', 'intro'
contentstringParagraph text
positionintOrdering 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.