PHPackages                             infinitum/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. infinitum/php-sdk

ActiveLibrary

infinitum/php-sdk
=================

FYI Infinitum package

v0.0.5(5y ago)080MITPHPPHP &gt;=7.0CI failing

Since Jun 28Pushed 5y agoCompare

[ Source](https://github.com/infinitum-dev/php-sdk)[ Packagist](https://packagist.org/packages/infinitum/php-sdk)[ RSS](/packages/infinitum-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

Infinitum SDK for PHP
=====================

[](#infinitum-sdk-for-php)

Installation
------------

[](#installation)

The [Infinitum](https://packagist.org/packages/infinitum/php-sdk) SDK can be installed via [Composer](https://getcomposer.org/).

```
composer require infinitum/php-sdk

```

Usage
-----

[](#usage)

---

### API Initialization

[](#api-initialization)

To use the Inifnitum you need to provide the `API Token`, the registered and licensed device `identity` and the corresponding `workspace`.

```
$infinitum = new \Fyi\Infinitum\Infinitum($workspace, $token, $identity);
```

### Setting the Access Token

[](#setting-the-access-token)

To use the modules, you first must call the `init()` method or set the access token via `setAccessToken()` if you already have an access token persisted/stored.

Example:

```
if (Session::get('access_token')) {
  $access_token = Session::get('access_token');
  $infinitum->setAccessToken($access_token);
} else {
  try {
    $response = $infinitum->init();
    $access_token = $response["access_token"];
    Session::put('access_token', $access_token);
  } catch (\Fyi\Infinitum\Exceptions\InfinitumAPIException $exc) { } catch (\Fyi\Infinitum\Exceptions\InfinitumSDKException $exc) { }
}
```

### Modules

[](#modules)

To user modules, you must first fetch the module accessing the `\Fyi\Infinitum\Infinitum` object

```
use \Fyi\Infinitum\Infinitum;

$infinitum = new Infinitum($workspace, $token, $key, $secret);
$infinitum->init();

$userAPI = $infinitum->user();
```

and then the methods are accessible (methods listed further on).

All API methods snippets show an example `data` object and the expected `response` structure.

There are 2 exceptions to be caught: `\Fyi\Infinitum\Exceptions\InfinitumSDKException` and `\Fyi\Infinitum\Exceptions\InfinitumAPIException` both explained here.

#### User

[](#user)

The User API object can be retrieved by calling it from the `\Fyi\Infinitum\Infinitum` object

```
$userAPI = $infinitum->user();
```

##### Register new User

[](#register-new-user)

The required parameters for registering a new user rely on the chosen Infinitum API configuration, like so, all SDK parameters are considered `optional`.

```
$data = [
  "name"  => "SDK User name",
  "password" => "password123",
  "email" => "sdkuser@infinitum.app",
  "photo" => File,
  "photo64" => "data:image/png;base64,.....",
  "birthdate" => "1/1/1970",
  "language"  => "en-US"
];
$response = $userAPI->register($data);
```

Response:

```
{
  "id": 1
}

```

There are also optional arrays (json string encoded) related to additional user information. Refer the Infinitum API docs for more information.

##### Get User by Face

[](#get-user-by-face)

Fetch a user by providing a picture of the User's face.

```
$data = [
  "photo"  => File,
  "photo64" => "data:image/png;base64,.....",
];
$response = $userAPI->face($data);
```

Response:

```
{
    "id": 1,
    "name": "SDK User",
    "email": "sdkuser@infinitum.app",
    "reference_token": "v71eELUThEPA2yzPBkxjPxWwbPgHANxF",
    "state_id": 1,
    "roles": [
        {
            "id": 1,
            "name": "Admin",
            "alias": "admin",
            "permissions": ["all"],
            "backoffice": 1,
            "deleted_at": null,
            "pivot": {
                "user_id": 4,
                "role_id": 1
            }
        }
    ],
    "info": {
        "birthdate": "01/01/2019",
        "language": null,
        "photo": "./storage/public/users/photos/example.png"
    }
}
```

##### Get User by Email address

[](#get-user-by-email-address)

Fetch a user by providing its email address.

```
$data = [
  "email"  => "sdkuser@infinitum.app",
];
$response = $userAPI->getByEmail($data);
```

Response:

```
{
    "id": 1,
    "name": "SDK User",
    "email": "sdkuser@infinitum.app",
    "reference_token": "v71eELUThEPA2yzPBkxjPxWwbPgHANxF",
    "state_id": 1,
    "roles": [
        {
            "id": 1,
            "name": "Admin",
            "alias": "admin",
            "permissions": ["all"],
            "backoffice": 1,
            "deleted_at": null,
            "pivot": {
                "user_id": 4,
                "role_id": 1
            }
        }
    ],
    "info": {
        "birthdate": "01/01/2019",
        "language": null,
        "photo": "./storage/public/users/photos/example.png"
    }
}
```

##### Get all Users

[](#get-all-users)

Fetch a user by providing its email address.

```
$response = $userAPI->getUsers();
```

Response:

```
[
    {
        "id": 1,
        "name": "SDK User"
        // (...)
    },
    {
        "id": 2,
        "name": "SDK User2"
        // (...)
    }
    // (...)
]
```

##### Delete User

[](#delete-user)

Delete a user by providing its unique ID.

```
$data = [
  "id" => 1
];

$response = $userAPI->deleteUser($data);
```

Response:

```
["success"]
```

##### Notify a User

[](#notify-a-user)

Send a notification to a User.

```
$data = [
	'action'  => 'infinitum-password-reset', // required
	'subject' => 'Infinitum Password Reset',
	'content' => 'Conent example',
	'to'      => 'infinitum.user@infinitum.app',
	'from'    => 'system@infinitum.app',
	'lang'    => 'pt-PT'
];

$response = $userAPI->notify($data);
```

The notification action is required due to being its primary identifier. Refer to the API docs for more information.

#### Device

[](#device)

The Device API object can be retrieved by calling it from the `\Fyi\Infinitum\Infinitum` object

```
$deviceAPI = $infinitum->device();
```

##### Register new Device

[](#register-new-device)

Register a new device in the Infinitum API.

```
$data = [
  "name" => "SDK Device",
  "mac_address"  => "AA:BB:CC:DD:EE:FF",
  "ip" => "192.168.1.2",
  "identity" => "device-unique-identity",
  "app_id" => "1",
  "device_type" => "PC",
  "licensed" => "",
  "app_version" => ""
];

$response = $deviceAPI->registerDevice($data);
```

There are also optional arrays (json string encoded) related to additional user information. Refer the [Infinitum API docs](http://infinitum.fyi.pt/developer) for more information.

```
{
    "id": 1
}
```

##### Register new Device User

[](#register-new-device-user)

Register a new association between a Device and a User.

```
$data = [
  "device_mac_address"  => "AA:BB:CC:DD:EE:FF",
  "user_email" => "sdkuser@infinitum.app",
  "device_id" => "1",
  "user_id" => "1"
];

$response = $deviceAPI->registerDeviceUser($data);
```

The data provided can either contain the `device_mac_address` or `device_id` along with the `user_email` or `user_id`, in order to search for a device/user with those properties or directly reference their unique IDs.

Response:

```
["success"]
```

##### License a Device

[](#license-a-device)

Update a device to either be licensed or revoke license to control access to the Infinitum API.

```
$data = [
  "mac_address"  => "AA:BB:CC:DD:EE:FF",
  "app_id" => "1",
  "licensed" => "1", # can be 0, 1, true or false
];

$response = $deviceAPI->license($data);
```

Response:

```
["success"]
```

##### Validate a Device

[](#validate-a-device)

Validate whether or not a device is able/licensed to access the Infinitum API, and retrieve its information.

```
$data = [
  "mac_address"  => "AA:BB:CC:DD:EE:FF",
];

$response = $deviceAPI->validate($data);
```

Response:

```
{
    "id": 7,
    "name": "SDK Device",
    "ip": "192.168.1.2",
    "mac_address": "AA:BB:CC:DD:EE:FF",
    "identity": "device-unique-identity",
    "app_version": "1.0.0",
    "licensed": 1,
    "app": {
        // (...)
    },
    "users": [
        // (...)
    ]
}
```

##### Delete Device

[](#delete-device)

Delete a device by providing its unique ID.

```
$data = [
  "id" => 1
];

$response = $deviceAPI->deleteDevice($data);
```

Response:

```
["success"]
```

#### Auth

[](#auth)

The Auth API object can be retrieved by calling it from the `\Fyi\Infinitum\Infinitum` object

```
$authAPI = $infinitum->auth();
```

All Auth API requests have the same response:

```
{
    "id": 1,
    "name": "SDK User",
    "token": "(...)",
    "email": "sdkuser@infinitum.app"
}
```

##### Biometric Auth

[](#biometric-auth)

Authenticate a user against the Infinitum API using its face properties. Along with the user photo, additional parameters can be provided to specify the device and method used in the request.

```
$data = [
  "photo" => $file,
  "photo64" => "data:image/png;base64,....",
  "device" => 1,
  "device_ip" => "192.168.1.2",
  "device_mac_address" => "AA:BB:CC:DD:EE:FF",
  "device_mac_address_value" => "extended-parameter",
  "action" => "entrance",
  "proximity" => "near",
  "data" => [] # additional custom parameters
];

$response = $deviceAPI->biometric($data);
```

##### Login

[](#login)

Authenticate a user against the Infinitum API using regular login parameters: `email` and `password`.

```
$data = [
  "email" => "sdkuser@fyi.pt",
  "password" => "password123"
];

$response = $deviceAPI->login($data);
```

##### Code

[](#code)

Authenticate a user against the Infinitum API using a unique code from to the user's possible codes.

```
$data = [
  "used_codes" => [
    ["code" => "abc1", "date" => "01-01-2019 18:00:00"],
    ["code" => "abc12", "date" => "01-01-2019 18:00:00"]
  ],
  "device_mac_address" => "AA:BB:CC:DD:EE:FF"
];

$response = $deviceAPI->code($data);
```

#### CMS

[](#cms)

The CMS API object can be retrieved by calling it from the `\Fyi\Infinitum\Infinitum` object

```
$authAPI = $infinitum->cms();
```

### Exceptions

[](#exceptions)

Both exceptions extend the base PHP `Exception` class so all related [methods](https://www.php.net/manual/en/class.exception.php) are available.

#### InfinitumAPIException

[](#infinitumapiexception)

This exception is thrown when an API error occurrs either due to malformed requests, server errors or any other error related to the Infinitum API. In addtition to the methods provided by the `Exception` class, a `getBody()` method is also available, to fetch the response body sent by the Infinitum API containing the error information (message, type and status code).`

Error body structure:

```
[
  "message" => "The provided email has already been taken.",
  "type"    => "VALIDATOR_ERROR",
  "status"  => 400
]
```

Usage example:

```
try {
  $response = $deviceAPI->biometric([
                "photo" => $file,
              ]);
  // (...)
} catch (\Fyi\Infinitum\Exceptions\InfinitumAPIException $exc) {
  return $exc->getBody();
}
```

#### InfinitumSDKException

[](#infinitumsdkexception)

The SDK exception is thrown in case of any error during the execution of any SDK method, unrelated to the API calls. This exception is mostly used when parameters are missing before executing a request that requires any of those parameters. Example:

and can be caught as any exception:

```
try {
  $response = $userAPI->getByEmail([]);
  // (...)
} catch (\Fyi\Infinitum\Exceptions\InfinitumSDKException $exc) {
  return $exc->getMessage();
}
```

The return value would be `Missing Email parameter.`.

#### MissingTokenException

[](#missingtokenexception)

This exception has `InfinitumSDKException` as a parent, but it is only used when the access token is missing, meaning that an `init()` or `setAccessToken()` call was never done. It can be caught either by expecting the `MissingTokenException` class itself or its parent `InfinitumSDKException`.

```
try {
  $response = $userAPI->register($data);
  // (...)
} catch (\Fyi\Infinitum\Exceptions\MissingTokenException $exc || \Fyi\Infinitum\Exceptions\InfinitumSDKException $exc ) {
  return $exc->getMessage();
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~68 days

Recently: every ~84 days

Total

7

Last Release

2105d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c3b350382729b2d7a4ca5d5b50a79fbb8ee18ae3c4aa86a1832b75c96daac68?d=identicon)[infinitum-dev](/maintainers/infinitum-dev)

---

Top Contributors

[![infinitum-dev](https://avatars.githubusercontent.com/u/51962772?v=4)](https://github.com/infinitum-dev "infinitum-dev (2 commits)")

---

Tags

fyiinfinitum

### Embed Badge

![Health badge](/badges/infinitum-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/infinitum-php-sdk/health.svg)](https://phpackages.com/packages/infinitum-php-sdk)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
