fhir
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
This is a Laravel package for talking to a LibreEHR database via FHIR API, (*2)
Installation
Via Composer, (*3)
Get composer, (*4)
getcomposer.com, (*5)
Create a Laravel 5.3 project
``` bash
$ composer create-project --prefer-dist laravel/laravel=5.3.* libre-ehr-laravel-5-3, (*6)
Require the fhir package which includes LibreEHR/core for as an interface to the LibreEHR database, for now it is in development and should be grabbed by developers via github.
Add the following to the root libre-ehr-laravel/composer.json after the "type"
``` json
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/LibreEHR/fhir.git"
},
{
"type": "vcs",
"url": "https://github.com/LibreEHR/core.git"
}
],
...
Then add the following to the "require" section of the libre-ehr-laravel/composer.json file which will specify the requirement of the development version of libre-ehr/fhir.
``` json
..., (*7)
"libre-ehr/fhir": "dev-master", (*8)
..., (*9)
Then add the following to the bottom of the libre-ehr-laravel/composer.json file, which will allow you to pull the development version.
``` json
...,
"minimum-stability": "dev",
"prefer-stable": true
...
Then from the root of libre-ehr-laravel, run the following to pull in the LibreEHR packages, (*10)
``` bash
$ composer update, (*11)
Install Stripe for payment
composer require stripe/stripe-php, (*12)
Install the Passport Auth package.
``` bash
$ composer require laravel/passport
Place your database credentials in the file libre-ehr-laravel/config/database.php in the mysql section, (*13)
Create a new section for 'auth' and make auth the default in config/database.php like this:
``` bash
..., (*14)
'default' => 'auth',
..., (*15)
'auth' => [
'driver' => 'mysql',
'host' => '127.0.0.1',
'port' => '3336',
'database' => 'libreehr_api',
'username' => 'libreehr_api',
'password' => 'libreehr_api',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
..., (*16)
Point a vhost to libre-ehr-laravel/public.
Make sure to enable mod_rewrite on Apache.
## Usage
To integrate with Laravel, there is a service provider you can make use of to automatically prepare the bindings and such.
Add the following to the end of the "providers" array in libre-ehr-laravel/config/app.php
```php
// config/app.php
'providers' => [
'...',
LibreEHR\FHIR\Utilities\Providers\FHIRServiceProvider::class,
LibreEHR\FHIR\Utilities\Providers\CustomPassportServiceProvider::class,
];
run 'php artisan migrate' to install the users table and oauth tables, (*17)
run 'php artisan passport:install' to generate auth keys keys, (*18)
run "php artisan passport:client --password" to create a new client if needed (a password grant client is automatically created from passport:install command), (*19)
Change driver in guards => api section of auth.php to 'passport', (*20)
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
change user model in providers => users in auth.php to our custom user model, default user model missing hasPITokens, (*21)
'model' => LibreEHR\FHIR\Http\Controllers\Auth\AuthModel\User::class,
You will then be able to browse to the FHIR endpoint like so:, (*22)
http://[my vhost]/fhir/Patients
````
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details., (*23)
Security
If you discover any security related issues, please email ken@mi-squared.com instead of using the issue tracker., (*24)
Credits
License
The MIT License (MIT). Please see License File for more information., (*25)