PHPCap Docs | PHPCap API
Overview

Namespaces

  • IU
    • PHPCap
  • PHP

Classes

  • ErrorHandler
  • FileUtil
  • RedCap
  • RedCapApiConnection
  • RedCapProject

Interfaces

  • ErrorHandlerInterface
  • RedCapApiConnectionInterface

Exceptions

  • PhpCapException
  • Overview
  • Namespace
  • Class

Class RedCap

REDCap class used to represent a REDCap instance/site. This class is typically only useful if your progam needs to create REDCap projects and/or needs to access more than one REDCap project.

Namespace: IU\PHPCap
Located at RedCap.php
Methods summary
public
+/- __construct( string $apiUrl, string $superToken = null, boolean $sslVerify = false, string $caCertificateFile = null, IU\PHPCap\ErrorHandlerInterface $errorHandler = null, IU\PHPCap\RedCapApiConnectionInterface $connection = null )

Parameters

$apiUrl
the URL for the API for your REDCap site.
$superToken

the user's super token. This needs to be provided if you are going to create projects.

$sslVerify
indicates if SSL connection to REDCap web site should be verified.
$caCertificateFile

the full path name of the CA (Certificate Authority) certificate file.

$errorHandler

the error handler that will be used. This would normally only be set if you want to override the PHPCap's default error handler.

$connection

the connection that will be used. This would normally only be set if you want to override the PHPCap's default connection. If this argument is specified, the $apiUrl, $sslVerify, and $caCertificateFile arguments will be ignored, and the values for these set in the connection will be used.

public IU\PHPCap\RedCapProject
+/- createProject( mixed $projectData, $format = 'php', string $odm = null )

Creates a REDCap project with the specified data.

Creates a REDCap project with the specified data.

The data fields that can be set are as follows:

  • project_title - the title of the project.
  • purpose - the purpose of the project:
    • 0 - Practice/Just for fun
    • 1 - Other
    • 2 - Research
    • 3 - Quality Improvement
    • 4 - Operational Support
  • purpose_other - text descibing purpose if purpose above is specified as 1.
  • project_notes - notes about the project.
  • is_longitudinal - indicates if the project is longitudinal (0 = False [default], 1 = True).
  • surveys_enabled - indicates if surveys are enabled (0 = False [default], 1 = True).
  • record_autonumbering_enabled - indicates id record autonumbering is enabled (0 = False [default], 1 = True).

Parameters

$projectData

the data used for project creation. Note that if 'php' format is used, the data needs to be an array where the keys are the field names and the values are the field values.

$format

the format used to export the arm data.

  • 'php' - [default] array of maps of values
  • 'csv' - string of CSV (comma-separated values)
  • 'json' - string of JSON encoded values
  • 'xml' - string of XML encoded data
$odm

Returns

IU\PHPCap\RedCapProject
the project that was created.
public IU\PHPCap\RedCapProject
+/- getProject( string $apiToken )

Gets the REDCap project for the specified API token.

Gets the REDCap project for the specified API token.

Parameters

$apiToken
the API token for the project to get.

Returns

IU\PHPCap\RedCapProject
the project for the specified API token.
public callable
+/- getProjectConstructorCallback( )

Gets the function used to create projects.

Gets the function used to create projects.

Returns

callable
the function used by this class to create projects.
public
+/- setProjectConstructorCallback( callable $ProjectConstructorCallback )

Sets the function used to create projects in this class. This method would normally only be used if you have extended the RedCapProject class and want RedCap to return projects using your extended class.

Sets the function used to create projects in this class. This method would normally only be used if you have extended the RedCapProject class and want RedCap to return projects using your extended class.

Parameters

$ProjectConstructorCallback

the function to call to create a new project. The function will be passed the same arguments as the RedCapProject constructor gets.

public IU\PHPCap\ErrorHandlerInterface
+/- getErrorHandler( )

Gets the error handler being used.

Gets the error handler being used.

Returns

IU\PHPCap\ErrorHandlerInterface
the error handler being used.
public
+/- setErrorHandler( IU\PHPCap\ErrorHandlerInterface $errorHandler )

Set the error handler that is used.

Set the error handler that is used.

Parameters

$errorHandler
the error handler to use.
public IU\PHPCap\RedCapApiConnectionInterface
+/- getConnection( )

Gets the connection being used.

Gets the connection being used.

Returns

IU\PHPCap\RedCapApiConnectionInterface
the connection being used.
public
+/- setConnection( IU\PHPCap\RedCapApiConnectionInterface $connection )

Sets the connection that is used.

Sets the connection that is used.

Parameters

$connection
the connection to use.
PHPCap API documentation generated by ApiGen