A REDCap Client library written in PHP
This lib requires the use of Composer.
"require": {
"dcarbone/amber-hat": "0.4.*"
}
To get started, you will need 3 things:
- Full URL to your REDCap installation's API endpoint (typically something like "https://redcap.mygreatinstitution.edu/api/")
- A REDCap API token
- A Temp directory on the server capable of handling potentially large files
Once you have those, you can immediately start exporting data for the project the token gives you access to:
use DCarbone\AmberHat\AmberHatClient;
$client = new AmberHatClient(
'https://redcap.mygreatinstitution.edu/api/',
'mygreattoken',
'my-cache-dir');
- Arms
- Events
- Metadata
- Export Field Names
- Project Information
- Form Events
- Users
- Instruments (forms)
- Records
- Record Field File
- Version
With the exception of Records, Project Information, and Record Field File, all export methods return a collection class which extends AbstractItemCollection. This collection class implements the following interfaces:
The objects present in the collection are all classes which implement the ItemInterface interface. The interface requires concrete classes to implement the following:
NOTE: For PHP 5.3 users, I have created a JsonSerializableCompatible interface, however you must execute json_encode on the result of the implemented method call, rather than on the object itself.
Ex:
$json_string = json_encode($itemObject->jsonSerialize());
At the moment, no import methods are available. However, this feature is being worked on and will hopefully come to fruition soon.