API for interacting with the LORIS Platform
This PHP package is automatically generated by the OpenAPI Generator project:
- API version: 0.0.4
- Build package: openapi-generator (php)
- OpenAPI specification: schema.yml
For more information, please visit https://github.com/aces/Loris
PHP 8.1 and later
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/aces/loris-php-client.git"
}
],
"require": {
"loris/php-client": "dev-main"
}
}Then run composer install
Download the files and include autoload.php:
require_once('/path/to/loris-php-client/vendor/autoload.php');To run the unit tests:
composer install
./vendor/bin/phpunitPlease follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use LORISClient\Configuration;
use LORISClient\Api\AuthenticationApi;
use LORISClient\Api\ClinicalApi;
use GuzzleHttp\Client;
// Configure API client
$config = Configuration::getDefaultConfiguration()
->setHost('https://loris.example.com/api/v0.0.3');
$httpClient = new Client(['verify' => true]);
// Authenticate and get token
$authApi = new AuthenticationApi($httpClient, $config);
try {
$result = $authApi->authenticate([
'username' => 'your_username',
'password' => 'your_password'
]);
$token = $result['token'];
// Configure API with token
$config->setAccessToken($token);
// Use the Clinical API
$clinicalApi = new ClinicalApi($httpClient, $config);
} catch (Exception $e) {
echo 'Exception: ', $e->getMessage(), PHP_EOL;
}
?>All URIs are relative to your LORIS instance API endpoint (e.g., https://loris.example.com/api/v0.0.3)
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AuthenticationApi | authenticate | POST /login | Authenticate and obtain JWT token |
| ClinicalApi | getInstruments | GET /instruments | Get list of instruments |
| ClinicalApi | getCandidates | GET /candidates | Get list of candidates |
| ClinicalApi | createCandidate | POST /candidates | Create a new candidate |
| ClinicalApi | getCandidate | GET /candidates/{candID} | Get candidate details |
| ClinicalApi | getVisit | GET /candidates/{candID}/{visitLabel} | Get visit information |
| ClinicalApi | createTimepoint | PUT /candidates/{candID}/{visitLabel} | Create timepoint/visit |
| ClinicalApi | getInstrumentData | GET /candidates/{candID}/{visitLabel}/instruments/{instrument} | Get instrument data |
| ClinicalApi | uploadInstrumentData | PUT /candidates/{candID}/{visitLabel}/instruments/{instrument} | Upload instrument data |
| ClinicalApi | uploadInstrumentCSV | POST /instrument_manager/instrument_data | Bulk upload instrument data via CSV |
- Authenticate200Response
- AuthenticateRequest
- Candidate
- CandidateCreate
- CandidateCreateCandidate
- CandidateDetail
- CreateCandidate201Response
- CreateCandidate201ResponseMeta
- GetCandidates200Response
- GetInstruments200Response
- GetInstruments401Response
- UploadInstrumentCSV200Response
- Visit
- VisitCreate
- Type: HTTP Bearer Token authentication
- Bearer format: JWT
- Description: JWT token obtained from /login endpoint
Example:
$config = Configuration::getDefaultConfiguration()
->setAccessToken('YOUR_JWT_TOKEN');This client is generated from the OpenAPI specification using OpenAPI Generator.
To regenerate the client:
./generate.shOr manually:
openapi-generator-cli generate \
-i schema.yml \
-g php \
-o . \
-c openapi-config.json \
--additional-properties=composerPackageName=loris/php-clientThis client supports LORIS API versions:
- v0.0.3
- v0.0.4
Configure the version in the base URL:
$config->setHost('https://loris.example.com/api/v0.0.3');Issues and pull requests are welcome on GitHub.
- LORIS - Longitudinal Online Research and Imaging System
The LORIS Team