PHPackages                             faulkj/fhirclient - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. faulkj/fhirclient

ActiveLibrary[HTTP &amp; Networking](/categories/http)

faulkj/fhirclient
=================

A simple PHP client for SMART on FHIR.

v3.0.1(2y ago)01.2kUnlicensePHPPHP &gt;=7.0

Since Sep 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/faulkj/FHIRClient)[ Packagist](https://packagist.org/packages/faulkj/fhirclient)[ Docs](https://github.com/faulkj/FHIRClient/)[ RSS](/packages/faulkj-fhirclient/feed)WikiDiscussions main Synced 3w ago

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

FHIRClient
==========

[](#fhirclient)

A simple PHP client for SMART on FHIR, the standard API for integrating applications with any modern healthcare system.

### Installation

[](#installation)

```
$ composer require faulkj/fhirclient
```

Basic Usage
-----------

[](#basic-usage)

### EMR Ebedded Mode

[](#emr-ebedded-mode)

On initial load:

```
//Assumining this is the URL loaded by the EMR:  https://my.website.com/launch/?iss=https://my.fhirserver.com/FHIRProxy/api/FHIR/R4&launch=abc123

use FaulkJ\FHIRClient;
session_start();

$iss = parse_url($_GET["iss"]);
$_SESSION["fhirParams"] = [
   "{$iss['scheme']}://{$iss['host']}",
   "1234-5678-9012-3456-7890",
   [
      "redirectURI" => "https://my.website.com"
   ]
];
$fhir = new FHIRClient(...$_SESSION["fhirParams"]);
$fhir->getConformance($_GET["iss"]);
$fhir->getAuthCode();
```

This will first get an Conformance Statement/SMART Configuration from *my.fhirserver.com/FHIRProxy/api/FHIR/R4* to retrieve the authorization and token endpoints. It will then request an authorization code from the authorization endpoint, triggering a redirect to *my.website.com*.

On *my.website.com* when redirected:

```
use FaulkJ\FHIRClient;
session_start();

$fc = new FHIRClient(...$_SESSION["fhirParams"]);
$fc->getAccessToken($_GET["code"]);

//You are now authenticated and may query the FHIR server
$obs = $fc->query("Observation?patient=12345678&code=12345-6");
if($obs->code == 200) echo $obs->body;
```

On subsequent page loads or AJAX calls, the FHIRClient will need to be reinstanciated before yoy can send a query:

```
use FaulkJ\FHIRClient;
session_start();

$fc = new FHIRClient(...$_SESSION["fhirParams"]);
$pat = $fc->query("Patient/12345678");
if($pat->code == 200) echo $pat->body;
```

### Standalone Mode

[](#standalone-mode)

On initial load:

```
use FaulkJ\FHIRClient;
session_start();

$iss = parse_url($_GET["iss"]);
$_SESSION["fhirParams"] = [
   "https:/my.fhirserver.com",
   "1234-5678-9012-3456-7890",
   [
      "state"       => base64_encode(rand()),
      "redirectURI" => "https://my.website.com",
      "authURI"     => "FHIRProxy/oauth2/authorize",
      "tokenURI"    => "FHIRProxy/oauth2/token"
   ]
];
$fc = new FHIRClient(...$_SESSION["fhirParams"]);
$fc->getConformance($_GET["iss"]);
$fc->getAuthCode();
```

This example includes a randomly generated *state* parameter and will request an authorization code from *my.fhirserver.com/FHIRProxy/oauth2/authorize*, triggering a redirect to *my.website.com*.

On *my.website.com* when redirected:

```
use FaulkJ\FHIRClient;
session_start();

$fc = new FHIRClient(...$_SESSION["fhirParams"]);
$fc->getAccessToken($_GET["code"]);

//You are now authenticated and may query the FHIR server
$obs = $fc->query("Observation?patient=12345678&code=12345-6");
if($obs->code == 200) echo $obs->body;
```

On subsequent page loads or AJAX calls, the FHIRClient will need to be reinstanciated before yoy can send a query:

```
use FaulkJ\FHIRClient;
session_start();

$fc = new FHIRClient(...$_SESSION["fhirParams"]);
$pat = $fc->query("Patient/12345678");
if($pat->code == 200) echo $pat->body;
```

### Backend Mode

[](#backend-mode)

```
use FaulkJ\FHIRClient;

$fc = (new FHIRClient(
   "https:/fhir.server.com",
   "1234-5678-9012-3456-7890",
   [
      "signingKey" => "D:\\privatekey.pem",
      "tokenURI"   => "FHIRProxy/oauth2/token"
   ]
))->debug(true);

$fc->getAccessToken();

$response = $fc->query("FHIRProxy/path/to/api/");
if($response->code == 200) echo $response->body;
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~167 days

Recently: every ~152 days

Total

7

Last Release

748d ago

Major Versions

v1.2 → v2.02022-10-06

v2.1.1 → v3.02024-05-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3419720?v=4)[Joshua H. Faulkenberry](/maintainers/faulkj)[@faulkj](https://github.com/faulkj)

---

Top Contributors

[![faulkj](https://avatars.githubusercontent.com/u/3419720?v=4)](https://github.com/faulkj "faulkj (35 commits)")

---

Tags

clientfhirhealthcarephpsmart-on-fhirclientcurlweb servicefetch

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/faulkj-fhirclient/health.svg)

```
[![Health](https://phpackages.com/badges/faulkj-fhirclient/health.svg)](https://phpackages.com/packages/faulkj-fhirclient)
```

###  Alternatives

[eightpoints/guzzle-bundle

Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony. Comes with easy and powerful configuration options and optional plugins.

44512.4M57](/packages/eightpoints-guzzle-bundle)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.5k](/packages/ismaeltoe-osms)[zoonman/pixabay-php-api

PixabayClient is a PHP HTTP client library to access Pixabay's API

3355.9k](/packages/zoonman-pixabay-php-api)[jshensh/php-curl-class

PHP HTTP client, based on cURL

522.8k](/packages/jshensh-php-curl-class)

PHPackages © 2026

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