{"id":22777605,"url":"https://github.com/faulkj/fhirclient","last_synced_at":"2026-04-27T22:33:07.808Z","repository":{"id":56786244,"uuid":"400350858","full_name":"faulkj/FHIRClient","owner":"faulkj","description":"Simple PHP client for SMART on FHIR","archived":false,"fork":false,"pushed_at":"2024-05-22T00:34:11.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-23T01:06:21.220Z","etag":null,"topics":["client","fhir","healthcare","php","smart-on-fhir"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faulkj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-27T01:17:44.000Z","updated_at":"2024-06-08T17:40:25.136Z","dependencies_parsed_at":"2024-05-16T21:30:20.183Z","dependency_job_id":"279c5638-7338-448b-9a8c-c741300a3076","html_url":"https://github.com/faulkj/FHIRClient","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.2592592592592593,"last_synced_commit":"f2d81439d536ad7177a3e4c22318eabfadf038b3"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faulkj%2FFHIRClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faulkj%2FFHIRClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faulkj%2FFHIRClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faulkj%2FFHIRClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faulkj","download_url":"https://codeload.github.com/faulkj/FHIRClient/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246326600,"owners_count":20759436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","fhir","healthcare","php","smart-on-fhir"],"created_at":"2024-12-11T19:15:10.654Z","updated_at":"2026-04-27T22:33:07.781Z","avatar_url":"https://github.com/faulkj.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FHIRClient\nA simple PHP client for SMART on FHIR, the standard API for integrating applications with any modern healthcare system.\n\n### Installation\n```bash\n$ composer require faulkj/fhirclient\n```\n\n## Basic Usage\n\n\n### EMR Ebedded Mode\n\nOn initial load:\n```php\n//Assumining this is the URL loaded by the EMR:  https://my.website.com/launch/?iss=https://my.fhirserver.com/FHIRProxy/api/FHIR/R4\u0026launch=abc123\n\nuse FaulkJ\\FHIRClient;\nsession_start();\n\n$iss = parse_url($_GET[\"iss\"]);\n$_SESSION[\"fhirParams\"] = [\n   \"{$iss['scheme']}://{$iss['host']}\",\n   \"1234-5678-9012-3456-7890\",\n   [\n      \"redirectURI\" =\u003e \"https://my.website.com\"\n   ]\n];\n$fhir = new FHIRClient(...$_SESSION[\"fhirParams\"]);\n$fhir-\u003egetConformance($_GET[\"iss\"]);\n$fhir-\u003egetAuthCode();\n```\n\nThis 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_.\n\nOn _my.website.com_ when redirected:\n```php\nuse FaulkJ\\FHIRClient;\nsession_start();\n\n$fc = new FHIRClient(...$_SESSION[\"fhirParams\"]);\n$fc-\u003egetAccessToken($_GET[\"code\"]);\n\n//You are now authenticated and may query the FHIR server\n$obs = $fc-\u003equery(\"Observation?patient=12345678\u0026code=12345-6\");\nif($obs-\u003ecode == 200) echo $obs-\u003ebody;\n```\n\nOn subsequent page loads or AJAX calls, the FHIRClient will need to be reinstanciated before yoy can send a query:\n```php\nuse FaulkJ\\FHIRClient;\nsession_start();\n\n$fc = new FHIRClient(...$_SESSION[\"fhirParams\"]);\n$pat = $fc-\u003equery(\"Patient/12345678\");\nif($pat-\u003ecode == 200) echo $pat-\u003ebody;\n```\n\n\n### Standalone Mode\n\nOn initial load:\n```php\nuse FaulkJ\\FHIRClient;\nsession_start();\n\n$iss = parse_url($_GET[\"iss\"]);\n$_SESSION[\"fhirParams\"] = [\n   \"https:/my.fhirserver.com\",\n   \"1234-5678-9012-3456-7890\",\n   [\n      \"state\"       =\u003e base64_encode(rand()),\n      \"redirectURI\" =\u003e \"https://my.website.com\",\n      \"authURI\"     =\u003e \"FHIRProxy/oauth2/authorize\",\n      \"tokenURI\"    =\u003e \"FHIRProxy/oauth2/token\"\n   ]\n];\n$fc = new FHIRClient(...$_SESSION[\"fhirParams\"]);\n$fc-\u003egetConformance($_GET[\"iss\"]);\n$fc-\u003egetAuthCode();\n```\nThis 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_.\n\nOn _my.website.com_ when redirected:\n```php\nuse FaulkJ\\FHIRClient;\nsession_start();\n\n$fc = new FHIRClient(...$_SESSION[\"fhirParams\"]);\n$fc-\u003egetAccessToken($_GET[\"code\"]);\n\n//You are now authenticated and may query the FHIR server\n$obs = $fc-\u003equery(\"Observation?patient=12345678\u0026code=12345-6\");\nif($obs-\u003ecode == 200) echo $obs-\u003ebody;\n```\n\nOn subsequent page loads or AJAX calls, the FHIRClient will need to be reinstanciated before yoy can send a query:\n```php\nuse FaulkJ\\FHIRClient;\nsession_start();\n\n$fc = new FHIRClient(...$_SESSION[\"fhirParams\"]);\n$pat = $fc-\u003equery(\"Patient/12345678\");\nif($pat-\u003ecode == 200) echo $pat-\u003ebody;\n```\n\n### Backend Mode\n\n```php\nuse FaulkJ\\FHIRClient;\n\n$fc = (new FHIRClient(\n   \"https:/fhir.server.com\",\n   \"1234-5678-9012-3456-7890\",\n   [\n      \"signingKey\" =\u003e \"D:\\\\privatekey.pem\",\n      \"tokenURI\"   =\u003e \"FHIRProxy/oauth2/token\"\n   ]\n))-\u003edebug(true);\n\n$fc-\u003egetAccessToken();\n\n$response = $fc-\u003equery(\"FHIRProxy/path/to/api/\");\nif($response-\u003ecode == 200) echo $response-\u003ebody;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaulkj%2Ffhirclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaulkj%2Ffhirclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaulkj%2Ffhirclient/lists"}