PHPackages                             compredict/users-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. compredict/users-sdk

ActiveLibrary

compredict/users-sdk
====================

Enables PHP applications to create/modify users.

01.0kPHPCI failing

Since May 12Pushed 5y ago2 watchersCompare

[ Source](https://github.com/COMPREDICT-GmbH/users-sdk-php)[ Packagist](https://packagist.org/packages/compredict/users-sdk)[ RSS](/packages/compredict-users-sdk/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (5)Used By (0)

COMPREDICT's Users API Client
=============================

[](#compredicts-users-api-client)

PHP client for connecting to the COMPREDICT V1 REST API.

To find out more, visit the official documentation website:

Requirements
------------

[](#requirements)

- PHP 7.0 or greater
- cUrl extension enabled

**To connect to the API with basic auth you need the following:**

- (Optional) Admin API Key to register to Users. As we only allow administrative registration.

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

[](#installation)

Use the following Composer command to install the API client from [the COMPREDICT vendor on Packagist](https://packagist.org/packages/compredict/users-sdk):

```
 $ composer require compredict/users-sdk
 $ composer update
```

Namespace
---------

[](#namespace)

All the examples below assume the `Compredict\API\Users\Client` class is imported into the scope with the following namespace declaration:

```
use Compredict\API\Users\Client as Compredict;
```

Configuration
-------------

[](#configuration)

To use the API client in your PHP code, ensure that you can access `Compredict\API`in your autoload path (using Composer’s `vendor/autoload.php` hook is recommended).

Provide your credentials to the static configuration hook to prepare the API client for connecting to a store on the COMPREDICT platform:

### Basic Auth

[](#basic-auth)

```
$compredict_client = Compredict::getInstance(
    'Admin-token', // optional, only needed if the implementers needs to register new users.
);
```

Login user (GET)
----------------

[](#login-user-get)

To list all the algorithms in a collection:

```
$user = $compredict_client->loginUser($username, $password);

# another option

use Compredict\API\Users\Resources\User as User;

$user = User::login($username, $password);
```

To get user information:

```
$user->first_name;
$user->last_name;
$user->organization;
$user->phone_number;
$user->email;
$user->apiKey;
```

User (GET/PUT)
--------------

[](#user-getput)

You can refresh user information by requesting the user info again through API:

```
$user->refersh();
```

Additionally you can update the user information by requesting the user:

```
$user->first_name = "Ousama";
$user->last_name = "Esbel";
$user->phone_number = "00491**********";
$user->update();
```

If the update fails, then the changes you made will be overridden with the previous values!

Reset Password (POST)
---------------------

[](#reset-password-post)

To reset a user's password, you should pass the user's Email. An email will be received where it will redirect the user to form to rechange the password.

```
$compredict_client->resetPassword($email);
```

Register new User (POST)
------------------------

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

In order to register new user, you should have administrative role where you should provide a token to Client instance or pass it through function `setAdminKey@Client`.

```
$compredict_client = Compredict::getInstance($token);

// or

$compredict_client = Compredict::getInstance();
$compredict_client->setAdminKey($API_KEY);
```

then you can either do:

```
$user = $compredict_client->registerUser($username, $email, $password1, $password2, $organization, $first_name=null, $last_name=null, $phone_number=null);

```

of use the static function is User:

```
$user = User::register($username, $email, $password1, $password2, $organization, $first_name=null, $last_name=null, $phone_number=null)

```

Handling Errors And Timeouts
----------------------------

[](#handling-errors-and-timeouts)

For whatever reason, the HTTP requests at the heart of the API may not always succeed.

Every method will return false if an error occurred, and you should always check for this before acting on the results of the method call.

In some cases, you may also need to check the reason why the request failed. This would most often be when you tried to save some data that did not validate correctly.

```
$algorithms = $compredict_client->getAlgorithms();

if (!$algorithms) {
    $error = $compredict_client->getLastError();
    echo $error->code;
    echo $error->message;
}
```

Returning false on errors, and using error objects to provide context is good for writing quick scripts but is not the most robust solution for larger and more long-term applications.

An alternative approach to error handling is to configure the API client to throw exceptions when errors occur. Bear in mind, that if you do this, you will need to catch and handle the exception in code yourself. The exception throwing behavior of the client is controlled using the failOnError method:

```
$compredict_client->failOnError();

try {
    $orders = $compredict_client->getAlgorithms();

} catch(Compredict\API\Error $error) {
    echo $error->getCode();
    echo $error->getMessage();
}
```

The exceptions thrown are subclasses of Error, representing client errors and server errors. The API documentation for response codes contains a list of all the possible error conditions the client may encounter.

Verifying SSL certificates
--------------------------

[](#verifying-ssl-certificates)

By default, the client will attempt to verify the SSL certificate used by the COMPREDICT AI Core. In cases where this is undesirable, or where an unsigned certificate is being used, you can turn off this behavior using the verifyPeer switch, which will disable certificate checking on all subsequent requests:

```
$compredict_client->verifyPeer(false);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 65.2% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fcdf88c1da917a892275da84363277347d0a1d51aa7b118d7e79130229894b4e?d=identicon)[compredict](/maintainers/compredict)

---

Top Contributors

[![uzi0espil](https://avatars.githubusercontent.com/u/5475253?v=4)](https://github.com/uzi0espil "uzi0espil (15 commits)")[![fadighattas100](https://avatars.githubusercontent.com/u/8566982?v=4)](https://github.com/fadighattas100 "fadighattas100 (8 commits)")

### Embed Badge

![Health badge](/badges/compredict-users-sdk/health.svg)

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

PHPackages © 2026

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