PHPackages                             ecourty/data-gouv-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ecourty/data-gouv-client

ActiveLibrary[API Development](/categories/api)

ecourty/data-gouv-client
========================

A PHP client library for the data.gouv.fr API.

v1.0.0(2mo ago)00MITPHPPHP &gt;=8.4CI failing

Since May 23Pushed 1mo agoCompare

[ Source](https://github.com/EdouardCourty/data-gouv-client)[ Packagist](https://packagist.org/packages/ecourty/data-gouv-client)[ RSS](/packages/ecourty-data-gouv-client/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (7)Versions (5)Used By (0)

data-gouv-client
================

[](#data-gouv-client)

[![CI](https://github.com/EdouardCourty/data-gouv-client/actions/workflows/ci.yml/badge.svg)](https://github.com/EdouardCourty/data-gouv-client/actions/workflows/ci.yml)

A typed PHP 8.4 client for French government APIs, auto-generated from their official OpenAPI specifications.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Supported APIs](#supported-apis)
- [Quick Start](#quick-start)
- [Development &amp; Contribution](#development--contribution)

---

Requirements
------------

[](#requirements)

- PHP 8.4+
- Composer

---

Installation
------------

[](#installation)

```
composer require ecourty/data-gouv-client
```

---

Supported APIs
--------------

[](#supported-apis)

APIClient classAuthDocumentation[data.gouv.fr](https://www.data.gouv.fr/api/1/)`DataGouvClient`Optional API key[docs/datagouv.md](docs/datagouv.md)[SIRENE (INSEE)](https://api.insee.fr/api-sirene/3.11)`SireneClient`API key required[docs/sirene.md](docs/sirene.md)[Recherche d'entreprises](https://recherche-entreprises.api.gouv.fr)`EntrepriseClient`None[docs/entreprise.md](docs/entreprise.md)[Géoplateforme Géocodage](https://data.geopf.fr/geocodage)`GeoplatformeClient`Optional Bearer token[docs/geoplateforme.md](docs/geoplateforme.md)[API Géo](https://geo.api.gouv.fr)`GeoClient`None[docs/geo.md](docs/geo.md)[Info Financière](https://www.info-financiere.gouv.fr)`InfoFinanciereClient`Optional API key[docs/infofinanciere.md](docs/infofinanciere.md)[Éducation Nationale](https://data.education.gouv.fr/api/v2)`EducationClient`None[docs/education.md](docs/education.md)[Annuaire des services publics](https://api-lannuaire.service-public.gouv.fr)`AnnuaireServicePublicClient`None[docs/annuaire-service-public.md](docs/annuaire-service-public.md)[Calendrier Scolaire](https://data.education.gouv.fr/api/v2)`CalendrierScolaireClient`None[docs/calendrierscolaire.md](docs/calendrierscolaire.md)[Jours Fériés](https://calendrier.api.gouv.fr/jours-feries/)`JoursFeriesClient`None[docs/joursferies.md](docs/joursferies.md)Sub-clients are exposed as **PHP 8.4 virtual property hooks** — access them directly, no method call needed.

---

Quick Start
-----------

[](#quick-start)

```
use Ecourty\DataGouv\DataGouv\DataGouvClient;

// Anonymous read-only access
$client = new DataGouvClient();
$datasets = $client->datasets->listDatasets(['q' => 'budget', 'page_size' => 10]);

// Authenticated access (required for write operations)
$client = new DataGouvClient(apiKey: 'your-key');
$me = $client->me->getMe();
```

See each API's documentation in [`docs/`](docs/) for details on authentication, sub-clients, and examples.

---

Development &amp; Contribution
------------------------------

[](#development--contribution)

### Setup

[](#setup)

```
git clone https://github.com/EdouardCourty/data-gouv-client
cd data-gouv-client
composer install
```

### Regenerate from the API specs

[](#regenerate-from-the-api-specs)

The library is fully generated from live OpenAPI specs. To regenerate:

```
composer generate                                    # all APIs (download → Jane → patch → facade → cs-fix)
php bin/console generate --api=datagouv             # data.gouv.fr only
php bin/console generate --api=sirene               # INSEE SIRENE only
php bin/console generate --api=entreprise           # Recherche d'entreprises only
php bin/console generate --api=geoplateforme        # Géoplateforme Géocodage only
php bin/console generate --api=geo                  # API Géo only
php bin/console generate --api=infofinanciere       # Info Financière only
php bin/console generate --api=education            # Éducation Nationale only
php bin/console generate --api=annuaireservicepublic # Annuaire des services publics only
php bin/console generate --api=calendrierscolaire   # Calendrier Scolaire only
php bin/console generate --api=joursferies          # Jours Fériés only
```

> **Do not manually edit** anything under `src/*/Client/`, `src/*/Api/`, `src/*/Exception/`, or the `*Client.php` facades — these files are fully generated. To change their output, edit the scripts in `bin/` or `src/Generator/` and re-run `composer generate`.

### QA

[](#qa)

```
composer test              # all tests (unit + integration)
composer test-unit         # unit tests only
composer test-integration  # integration tests (hits the real API)
composer phpstan           # static analysis
composer cs-check          # code style check
composer cs-fix            # auto-fix code style
composer qa                # phpstan + cs-check + all tests
```

### Adding a new API

[](#adding-a-new-api)

Use the provided CLI command:

```
php bin/console add-api \
  --name=myapi \
  --spec-url=https://api.example.com/openapi.json \
  --namespace="Ecourty\DataGouv\DataServices\MyApi" \
  --base-url=https://api.example.com \
  --auth=none \
  --generate
```

See [`.github/skills/support-new-api/SKILL.md`](.github/skills/support-new-api/SKILL.md) for the full guide.

### Contributing

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Make your changes (update `AGENTS.md`, `README.md`, and `docs/` as needed)
4. Ensure `composer qa` passes
5. Open a pull request

#### Writing integration tests

[](#writing-integration-tests)

Every API domain has integration tests in `tests/Integration/{Domain}/`. When adding a new API or a new endpoint, add the corresponding integration test:

- Extend `IntegrationTestCase` and annotate with `#[Group('integration')]`
- Wrap all API calls with `$this->callApi(fn () => ...)` — it auto-skips on network errors and rate limits
- For "get by ID" endpoints, derive the ID from the list endpoint first
- For ODS-platform APIs (OpenDataSoft), use `$client->getClient()->method(FETCH_RESPONSE)` and `$this->decodeResponse($response)` since their Jane-generated typed methods return `null`

Run integration tests with:

```
composer test-integration                               # all domains
composer validate-integration-coverage                  # verify every domain has ≥1 test
./vendor/bin/phpunit tests/Integration/{Domain}/        # one domain only
```

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance89

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3150ffb131124e5f03272d9ed8084c514f18fff6aafff1a5973c016993f6ef66?d=identicon)[ecourty](/maintainers/ecourty)

---

Top Contributors

[![EdouardCourty](https://avatars.githubusercontent.com/u/37371516?v=4)](https://github.com/EdouardCourty "EdouardCourty (20 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

phpapiclientdata.gouv.frdata-gouv

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ecourty-data-gouv-client/health.svg)

```
[![Health](https://phpackages.com/badges/ecourty-data-gouv-client/health.svg)](https://phpackages.com/packages/ecourty-data-gouv-client)
```

###  Alternatives

[jolicode/slack-php-api

An up to date PHP client for Slack's API

2554.7M13](/packages/jolicode-slack-php-api)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

46688.8k5](/packages/deepseek-php-deepseek-php-client)[openai-php/symfony

Symfony Bundle for OpenAI

220871.3k3](/packages/openai-php-symfony)[apigee/apigee-client-php

Client library for connecting to the Apigee Edge API.

27584.5k4](/packages/apigee-apigee-client-php)[google-gemini-php/symfony

Symfony Bundle for Gemini

1513.7k2](/packages/google-gemini-php-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
