The vsUAccess
class provides a PHP interface to interact with the UniFi Access API. It simplifies the process of managing users, doors, and system logs through a straightforward PHP class. This class is intended for developers who need to integrate UniFi Access functionalities within their PHP applications.
- User management (create, update, retrieve)
- Door operations (list, lock, unlock)
- Retrieve system logs
- Manage user PIN codes
- PHP 7.2 or higher
- cURL extension enabled in PHP
- Valid UniFi Access API credentials
To use the vsUAccess
class in your project, include the vsUAccess.php
file in your project directory and require it in your PHP script.
require_once 'path/to/vsUAccess.php';
$api = new vsUAccess("https://your-unifi-access-host", 12445, 'your_api_token_here');
$response = $api->createUser('John', 'Doe', '123456', 1625158800, 'john.doe@example.com');
print_r($response);
$response = $api->updateUser('user_id', 'Jane', 'Doe', '654321', 1625158800, 'jane.doe@example.com');
print_r($response);
$response = $api->getUser('user-id');
print_r($response);
$response = $api->viewUsers();
print_r($response);
$response = $api->door_list();
print($response);
$response = $api->door_unlock('door_id');
print_r($response);
$response = $api->door_lock('door_id');
print_r($response);