Validate email with a call to an external API

1.0.0 2021-06-21 15:03 UTC

This package is auto-updated.

Last update: 2024-05-21 21:23:40 UTC


License Latest Stable Version Total Downloads Donate

This extension adds a rule to Flarum email validation that will use an external API request to validate the email.

This rule will apply everywhere an email is checked against the UserValidator including registration and email change requests.

The format of the external API request can be customized to meet a range of needs.

The data is expected to be passed in one of two ways: via query string, or via HTTP body.

The response can be read in one of two ways: a JSON key in the response, or the HTTP status code.

Additionally, an error message can optionally be read from a JSON key in the response. Otherwise, a default error message can be provided in the extension settings.

To inject the email value inside the URI or Body settings, use one of the following strings in the template:

  • {{ email | urlencode }}: This value will be replaced with the email value passed through PHP's urlencode() method
  • {{ email | json }}: This value will be replaced with the email value passed through PHP's json_encode(). This means the JSON string delimiters will be included!
  • {{ email | raw }}: This value will be replaced with the email value without any modification. Don't use this in the URI or JSON payload if you don't know what you're doing.


composer require clarkwinkelmann/flarum-ext-external-email-validation


This extension is under minimal maintenance.

It was developed for a client and released as open-source for the benefit of the community. I might publish simple bugfixes or compatibility updates for free.

You can contact me to sponsor additional features or updates.

Support is offered on a "best effort" basis through the Flarum community thread.

Integration tests

This extension has integration tests that rely on a local webserver running.

Run composer test:server to start the PHP development server on port 8000 with the docroot set to the fixtures folder.

Then you can run composer test:setup and composer test like regular Flarum integration tests.