Download the PHP package nugsoft/hikbridge-laravel-sdk without Composer

On this page you can find all versions of the php package nugsoft/hikbridge-laravel-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hikbridge-laravel-sdk

HikBridge Laravel SDK

Tests PHP Laravel

A Laravel SDK for the HikBridge External Integration API — a brand-agnostic REST API that sits between external business applications (HR, POS, clinic) and physical Hikvision access-control devices. This package abstracts the HikBridge API behind a clean, fluent PHP interface so your application never speaks the underlying device protocol directly.


Table of Contents


Requirements


Installation

The service provider and HikBridge facade are auto-discovered by Laravel — no manual registration is needed.

Publish the config file:


Configuration

Add the following to your .env file:

The published config/hikbridge.php exposes additional options:

Retries vs. error responses. Retries apply only to ConnectionException (the request never reached the server). Any HTTP response the server returns — including 5xx — flows straight through to the SDK's exception mapping, so a 500/503 becomes a ServerException you can catch, not a raw HTTP-client exception.


How It Works

The SDK exposes a single HikBridge facade. Every method group is accessed through a resource accessor:

Return types:


Demo Project

Get hands-on with the SDK through our demo project. You can either explore the source code or try the live hosted application:

The demo covers all major workflows including person management, biometric enrollment, access card registration, and webhook integration.


Authentication & Scopes

Every request to /v1/* is authenticated with the API key set in HIKBRIDGE_API_KEY. The key is sent as Authorization: Bearer hbk_... automatically.

Keys are scoped to a set of abilities. Attempting an endpoint the key is not scoped for returns a ForbiddenException (403).

Ability Grants access to
business:read GET /v1/business
devices:read GET /v1/devices, GET /v1/devices/:id
persons:read List, get, and poll operations
persons:write Create, update, delete persons
biometrics:read Biometric summaries, capture progress
biometrics:write Upload/delete face, fingerprints, access cards
events:read List and trigger event sync
webhooks:manage Full CRUD on webhook subscriptions

Resources

Business

Returns the single business the API key belongs to. Requires ability business:read.


Devices

Devices are the access-control units registered to the business. Every biometric operation requires a device_id from this list.

Device object includes: id, name, integration_mode, capabilities (e.g. face_capture, fingerprint_capture, card_enrollment).


Persons

Persons are the people managed across the business's devices. person_code is the cross-system identifier — it must be unique, alphanumeric, max 16 characters, and is immutable after creation.

List persons

Get one person

Create a person

Person creation has two modes depending on whether you include device_id:

Async (no device_id) — fans out to all active devices:

Sync (with device_id) — syncs to one device only:

Update a person

Delete a person from all devices (async)

Always returns a PendingOperation — the deletion fans out to every device.

Delete a person from one device (sync)


Biometrics

Biometric operations are always device-specific. Access them through HikBridge::biometrics(int $personId).

Capability check: Live capture endpoints (face capture, fingerprint capture) return 422 early if the device does not support that capability. Check $device['data']['capabilities'] beforehand if needed.

Summary

Face

Upload a face photo:

Live face capture (person stands in front of the device camera):

Delete face:

Fingerprint

finger_index uses the convention: 0 = right thumb, 1–4 = right index to right little, 5 = left thumb, 6–9 = left index to left little.

Store a fingerprint template:

Live fingerprint capture (person places finger on the scanner):

Delete a fingerprint:

Access Card

Register a card:

Remove a card:


Events

Access events are aggregated from all devices and stored in HikBridge. They are returned newest-first and are cursor-paginated.

List events

Paginate through all events:

Trigger a manual sync

HikBridge polls devices on a 5-minute schedule. Call triggerSync() for an on-demand pull. Both parameters are optional — the server defaults to the last 24 hours.


Webhooks

Webhooks push signed payloads to an external URL when events occur in HikBridge.

Supported event types:

Event type When it fires
access.event A person accesses a device
person.synced A person sync operation completes
* All event types

Create a subscription

List, get, update, delete

Send a test ping

Dispatches a signed test payload to the subscription URL. Useful for verifying your endpoint is reachable. Requires the queue worker running.

View delivery history

Verifying incoming webhook signatures

Every webhook delivery includes an X-HikBridge-Signature header signed with HMAC-SHA256.


Operations

Any endpoint that fans out to all devices returns HTTP 202 with an operation_id. Poll the operation to track per-device progress.

In practice, prefer PendingOperation::waitUntilDone() over manual polling — see the next section.


Async Operations & PendingOperation

Operations that target all active devices (create person, delete person, event sync) return a PendingOperation instead of an array. This object wraps the 202 response and lets you either poll manually or block until done.

Properties

waitUntilDone()

Blocks the current process, polling GET /v1/operations/{id} at regular intervals until the operation completes or the timeout expires.

Parameter Default Description
$timeout 60 Maximum seconds to wait before throwing
$interval 2 Seconds between each poll

Queues: Async operations require the Laravel queue worker to be running. In local development, php artisan queue:work (or composer dev if configured) handles this.


Exception Handling

All exceptions extend Nugsoft\HikBridge\Exceptions\HikBridgeException, so you can catch them individually or with the base class.

Exception HTTP status Notes
AuthenticationException 401 Invalid or missing API key
ForbiddenException 403 Key lacks the required ability
NotFoundException 404 Resource does not exist or belongs to another business
ValidationException 422 Invalid input — call ->errors() for field details
RateLimitException 429 Too many requests
ServerException 5xx HikBridge server error
HikBridgeException any Base class; also thrown on operation failure/timeout

ValidationException field errors:


Testing

The SDK wraps Laravel's Http facade, so Http::fake() is all you need — no custom mock layer or test doubles required.

Faking a successful response

Faking an async (202) create

Faking an error response

Faking a validation error

Asserting request details


License

MIT License. See LICENSE for details.


All versions of hikbridge-laravel-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nugsoft/hikbridge-laravel-sdk contains the following files

Loading the files please wait ...