FusionAuth PHP Client

PHP Client Library

The PHP client library allows you to integrate FusionAuth with your PHP application.

Source code:


composer require fusionauth/fusionauth-client

The following code assumes FusionAuth is running on http://localhost:9011 and uses an API key 6b87a398-39f2-4692-927b-13188a81a9a3, you will need to supply your own API key, and if you are not running FusionAuth locally, your host parameter may be different.

Here is an example of using the retrieveUserByEmail method to retrieve a User by an email address.

include_once 'FusionAuthClient.php'

$client = new FusionAuthClient('6b87a398-39f2-4692-927b-13188a81a9a3', 'http://localhost:9011');

$email = "user@example.com";
$response = client->retrieveUserByEmail($email);
    $user = $response->successResponse->user;
} else {
    // Handle $response->errorResponse or $response->exception