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.
LegifranceSourceclassLégifrance, through PISTE (the DILA's API, as its Swagger and its "Exemples d'utilisation de l'API" describe it):
10 methods · 3 constants
LegifranceSourceFactoryclassLé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 = 100The 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(): stringLegifranceSource::capabilities()
public function capabilities(): CapabilitiesLegifranceSource::request()
public function request(string $path, array $body = []): ?arrayAny method of the API, as its Swagger describes it: $legifrance->request('consult/kaliText', ['id' => 'KALITEXT000005677408']).
Null when the API answers 404.
LegifranceSource::search()
public function search(Query $query): ResultsLegifranceSource::recent()
public function recent(\DateTimeInterface $since, ?Query $query = null): ResultsLegifranceSource::text()
public function text(Identifier|string $id, ?\DateTimeInterface $at = null): ?TextLegifranceSource::article()
public function article(Identifier|string $id, ?string $number = null, ?\DateTimeInterface $at = null): ?ArticleLegifranceSource::decision()
public function decision(Identifier|string $id): ?DecisionLegifranceSource::citations()
public function citations(Identifier|string $id, int $limit = 100): arrayLegifranceSourceFactory 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
| Option | Default | |
|---|---|---|
sandbox | false | |
throttle | 0.5 | |
client_id | required | |
client_secret | required |