Skip to content

omnilex/legifrance API reference

Floor
Provider · Omnilex
Version
1.x
Conformance suite
not wired
Verified for real
Not verified for real
Licence
MIT
composer require omnilex/legifrance:1.x-dev

Read from the package's own PHP files at the commit de3fc832404d: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnilex\Legifrance

  • LegifranceSource class

    Légifrance, through PISTE (the DILA's API, as its Swagger and its "Exemples d'utilisation de l'API" describe it):

    10 methods · 3 constants

  • LegifranceSourceFactory class

    Légifrance, through PISTE: the application signs with its PISTE OAuth credentials (client credentials).

    4 options

Omnilex\Legifrance

LegifranceSource class

final class LegifranceSource extends HttpSource implements SearchInterface, TextReaderInterface, ArticleReaderInterface, DecisionReaderInterface, CitationsInterface, RecentInterface LegifranceSource.php:48

Légifrance, through PISTE (the DILA's API, as its Swagger and its "Exemples d'utilisation de l'API" describe it):

POST /search codes, consolidated texts, case law POST /consult/legiPart a consolidated text as in force at a date POST /consult/jorf, /consult/getJoWithNor, /consult/eliAndAliasRedirectionTexte a text as published in the Journal officiel POST /consult/getArticle, /consult/getArticleWithIdAndNum, /consult/getArticleWithIdEliOrAlias an article, and the list of its versions POST /consult/juri a decision of the judicial courts POST /consult/relatedLinksArticle what an article cites, what cites it POST /list/loda the laws, ordinances, decrees and orders published since a date

Every other documented method is one request() away.

const BASE_URI = 'https://api.piste.gouv.fr/dila/legifrance/lf-engine-app'
const SANDBOX_URI = 'https://sandbox-api.piste.gouv.fr/dila/legifrance/lf-engine-app'
const MAX = 100

The most results /search and /list give per page.

LegifranceSource::__construct()

public function __construct(HttpClientInterface $http, TokenProviderInterface $auth, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.5)

LegifranceSource::getName()

public function getName(): string

LegifranceSource::capabilities()

public function capabilities(): Capabilities

LegifranceSource::request()

public function request(string $path, array $body = []): ?array

Any method of the API, as its Swagger describes it: $legifrance->request('consult/kaliText', ['id' => 'KALITEXT000005677408']).

Null when the API answers 404.

public function search(Query $query): Results

LegifranceSource::recent()

public function recent(\DateTimeInterface $since, ?Query $query = null): Results

LegifranceSource::text()

public function text(Identifier|string $id, ?\DateTimeInterface $at = null): ?Text

LegifranceSource::article()

public function article(Identifier|string $id, ?string $number = null, ?\DateTimeInterface $at = null): ?Article

LegifranceSource::decision()

public function decision(Identifier|string $id): ?Decision

LegifranceSource::citations()

public function citations(Identifier|string $id, int $limit = 100): array

LegifranceSourceFactory class

final class LegifranceSourceFactory extends SourceFactory LegifranceSourceFactory.php:22

Légifrance, through PISTE: the application signs with its PISTE OAuth credentials (client credentials).

options: client_id: '...' client_secret: '...' sandbox: false # PISTE's sandbox, with the sandbox application's credentials throttle: 0.5 # seconds between two calls (the quotas are per application, on the portal) base_uri, token_uri # to override either

Options

OptionDefault
sandboxfalse
throttle0.5
client_idrequired
client_secretrequired