The IDpack Cloud PHP library provides convenient access to the IDpack API from PHP applications. The API is available with an IDC Professional or IDC Enterprise plan.
PHP 5.6.0 and later.
Not tested yet
- PHP 8.x
Include the idc.class.php
file into your project and set it up like this:
require_once 'idc.class.php';
$idc = new IDpack('username', 'password', 'user_secret_key', 'project_secret_key');
or
require_once 'idc.class.php';
$idc = new IDpack();
$idc->setUsername('username');
$idc->setPassword('password');
$idc->setUserSecretKey('user_secret_key');
$idc->setProjectSecretKey('project_secret_key');
require_once 'idc.class.php';
$idc = new IDpack('username', 'password', 'user_secret_key', 'project_secret_key');
$response = $idc->get_record(['idc_id_number' => '10000']);
echo $response;
{
"status": "success",
"message": null,
"code": 200,
"data": {
"record": {
"idc_id_number": "10000",
"idc_active": "1",
"idc_trash": "0",
"idc_colorcode": "6",
"idc_firstname": "David",
"idc_lastname": "Wilson",
"idc_mobilephone": null,
"idc_email": "david@example.com",
"idc_member_id": "163567",
"idc_expirationdate": "2026-01-22",
"idc_insdate": "2024-01-23 06:53:55",
"idc_moddate": "2024-01-23 14:53:16",
"idc_picturedate": "2024-01-29 18:12:39",
"idc_printdate": "2024-01-29 13:26:20"
}
},
"api": {
"api_action": "get_record",
"api_queries_remaining": 8345,
"api_software": "IDpack API",
"api_version": "3.2.26",
"api_request_date": "2025-01-05 19:30:12"
}
}
$response = $idc->get_all_records();
echo $response;
$response = $idc->get_photo_id(['idc_id_number' => '10000'], 'jpeg');
echo $response;
$response = $idc->get_badge_preview(['idc_id_number' => '10000'], 'jpeg');
echo $response;
$response = $idc->update_record(['idc_id_number' => '10000'], ['idc_firstname' => 'Julie', 'idc_lastname' => 'Smith']);
echo $response;
$response = $idc->insert_record(['idc_colorcode' => 2, 'idc_firstname' => 'Mark', 'idc_lastname' => 'Morgan']);
echo $response;
//get the inserted primary key
$insert_id = $idc->getInsertID();
$response = $idc->set_record_active(['idc_id_number' => '10000']);
echo $response;
$response = $idc->set_record_not_active(['idc_id_number' => '10000']);
echo $response;
$response = $idc->delete_record(['idc_id_number' => '10000']);
echo $response;