Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,27 @@ Important:

The source code is made available under the [EUPL 1.2 license](https://github.com/OpenWebconcept/plugin-prefill-gravity-forms/blob/main/LICENSE.md). Some of the dependencies are licensed differently, with the BSD or MIT license, for example.

## User model

The `UserModel` provides a simple way to access BRP (Basisregistratie Personen) data that has been retrieved after a valid DigiD login.
It automatically detects which data supplier is configured (in the add-on settings), loads the correct controller, and exposes a small set of helper methods for use in templates or form-prefill logic.

Before accessing any user attributes, always check whether the user is authenticated using DigiD.

### Usage

```php
$user = new \OWC\PrefillGravityForms\Models\UserModel();

if ( $user->isLoggedIn() ) {
$bsn = $user->bsn();
$age = $user->age();
}
```

This model does not handle authentication itself, it only exposes data retrieved by the underlying BRP supplier controller.
If a controller fails to load (e.g., misconfiguration or missing supplier), the model gracefully returns default values.

## Logging

Enable logging to monitor errors during communication with the BRP suppliers.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
}
],
"require": {
"monolog/monolog": "^3.0",
"php": "^8.0",
"php-di/php-di": "^7.0",
"owc/idp-userdata": "^1.0"
Expand Down
Loading