PHPackages                             covery/client - 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. covery/client

ActiveLibrary

covery/client
=============

Covery official client

1.6.0(4mo ago)816.5k↓39.5%8[1 PRs](https://github.com/covery/php-client/pulls)MITPHPPHP &gt;=8.0CI failing

Since Oct 10Pushed 4mo ago3 watchersCompare

[ Source](https://github.com/covery/php-client)[ Packagist](https://packagist.org/packages/covery/client)[ Docs](https://covery.ai/)[ RSS](/packages/covery-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (49)Used By (0)

Covery Client
=============

[](#covery-client)

[![Latest Stable Version](https://camo.githubusercontent.com/2661164c625dbc0b1d01ad8755a4cb596ed1b1d85fc1954369077dc69cc293ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f766572792f636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/covery/client)[![PHP Version](https://camo.githubusercontent.com/0f6a1a83f1793a3e0c5405190af6c57c8ea4a7d5783fdc441c77078bb476d9ac/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e302d626c75652e7376673f7374796c653d666c61742d737175617265)](http://php.net/)

Official PHP Covery Client

- [How to Start](#howto)
- [Basic Integration](#basic)
- Internals
    - [Facade](#facade)
    - [PSR-3 logging](#psr) [PSR-4 autoloading](#psr) and [PSR-7 HTTP messages](#psr)
    - [Transports](#transports)
    - [Envelopes](#envelopes)
    - [Results](#results)
    - [Exceptions](#exceptions)
    - [Error loggers](#loggers)
- [Changelog](#changelog)

How to Start
============

[](#how-to-start)

1. You need to acquire an access token and a secret
2. Install a client using composer: `composer require "covery/client=^1.0.0"`

Basic Integration
=================

[](#basic-integration)

The first thing you need is to initialize `Facade` with credentials and transport. To do this, place the following code somewhere close to your application initialization:

```
use Covery\Client\Facade;
use Covery\Client\Transport\Curl;

$connectTimeoutSeconds = 5.0;
$requestTimeoutSeconds = 2.0;
Facade::setTransport(new Curl($connectTimeoutSeconds, $requestTimeoutSeconds));
Facade::setCredentials('', '');
```

Optional (use only for debug):

```
use Covery\Client\Loggers\FileLogger;

//directory must be writable!
$filePath = "path_to_file/error.log";

Facade::setLogger(new FileLogger($filePath));
```

That's all!

Having completed this procedure, you can now query Covery using `Facade::sendEvent`, `Facade::sendPostback`, `Facade::makeDecision`.

Login event example:

```
use Covery\Client\Envelopes\Builder;
use Covery\Client\Facade;
use Covery\Client\Identities\Stub;

$event = Builder::loginEvent(md5($userId), string($userId), time(), 'foo@bar.com', false) // Using builder
    ->addIdentity(new Stub())                                                             // stub identity
    ->build();                                                                            // building envelope

$result = Facade::makeDecision($event);
if ($result->isReject()) {
    // ...
}
```

Postback event example:

```
use Covery\Client\Envelopes\Builder;
use Covery\Client\Facade;

$event = Builder::postbackEvent($requestId, null, 'code', 'reason')->build(); //postback for event with id $requestId
$postbackRequestId = Facade::sendPostback($event);
```

KycProof event example:

```
use Covery\Client\Envelopes\Builder;
use Covery\Client\Facade;

$event = Builder::kycProofEvent($kycStartId)->build();
$kycProofData = Facade::sendKycProof($event);
```

Card Id event example:

```
use Covery\Client\CardId\Builder;
use Covery\Client\Facade;

$event = Builder::cardIdEvent('curdNumber')->build();
$result = Facade::sendCardId($event);
```

Document Storage event example:

```
use Covery\Client\DocumentStorage\Builder;
use Covery\Client\Facade;

$event = Builder::documentStorageEvent(\Covery\Client\ContentType::JPEG, \Covery\Client\ContentDescription::GENERAL_DOCUMENT, null, false)->build();
$result = Facade::sendDocumentStorage($event);
```

Attach document connection event example:

```
use Covery\Client\DocumentConnection\Builder;
use Covery\Client\Facade;

$event = Builder::documentConnectionEvent(1, [1])->build();
$result = Facade::attachDocumentConnection($event);
```

Detach document connection event example:

```
use Covery\Client\DocumentConnection\Builder;
use Covery\Client\Facade;

$event = Builder::documentConnectionEvent(1, [1])->build();
$result = Facade::detachDocumentConnection($event);
```

Document file upload example:

```
use Covery\Client\Facade;

$stream = fopen('PATH_TO_FILE', 'r');
$documentUrl = 'UPLOAD_URL'; //URL from Covery
$documentFileUploader = \Covery\Client\DocumentFileUploader\Builder::documentFileUploaderEvent(
    $documentUrl,
    $stream
)->build();

$result = \Covery\Client\Facade::uploadDocumentFile($documentFileUploader);
```

Account Configuration Status event example:

```
use Covery\Client\Facade;

$accountConfigurationStatus = Facade::getAccountConfigurationStatus();
```

Tech Details
============

[](#tech-details)

Facade
------

[](#facade)

`Covery\Client\Facade` is a static wrapper over `Covery\Client\PublicAPIClient`. If you use dependency injection or other application assembly mechanism, you may prefer not to use `Facade`, and rather use the client directly.

PSR-3, PSR-4 and PSR7
---------------------

[](#psr-3-psr-4-and-psr7)

1. Covery client supports PSR-3 loggers. You may assign them to `Facade` calling `Facade::setLogger` or to `PublicAPIClient` passing a logger as a constructor argument.
2. Covery client code uses PSR-4 autoloader. Just require `/vendor/autoload.php`.
3. HTTP communication uses PSR-7 HTTP message, so you may extend the client's capabilities as you see fit.

Transports
----------

[](#transports)

Covery client may use any class that satisfies `Covery\Client\TransportInterface` to send requests. Covery client ships with two major implementations:

1. `Covery\Client\Transport\Curl` - simple PHP curl implementation
2. `Covery\Client\Transport\OverGuzzle` - adapter over [Guzzle](https://github.com/guzzle/guzzle) HTTP client

Envelopes
---------

[](#envelopes)

Methods `sendEvent` and `makeDecision` require envelope as argument. Envelope is a pack of following data:

- `SequenceID` - Event grouping identifier. Covery will attempt to group events using this field. It is recommended to use userID as a sequence ID. However, Covery requires a long string (6-40 characters) in this field, so you may use `md5($userId)` as `SequenceID` for better results.
- `Identities` - List of identities this event belongs to. For most cases a single `Identities\Stub` is enough.
- `Type` - Event type, one of:
    - `install` - install event
    - `registration` - registration event
    - `confirmation` - registration confirmation event, must have the same `SequenceID` with registration event
    - `login` - login event, must have the same `SequenceID` with registration event
    - `transaction` - payment event, must have the same `SequenceID` with registration and login events
    - `refund` - refund event
    - `payout` - payout event
    - `transfer` - transfer event
    - `kyc_profile` - kyc profile event
    - `kyc_submit` - kyc submit event
    - `order_item` - order item event
    - `order_submit` - order submit event
    - `document` - document event

Envelope specifications are bundled in `Covery\Client\EnvelopeInterface`.

You may provide the following as envelopes:

1. Own implementations of `EnvelopeInterface`. For example, your own payment order model may be extended to implement `EnvelopeInterface`, then you may pass it to `sendEvent` and/or `makeDecision` directly.
2. Custom-built `Covery\Client\Envelopes\Envelope`
3. Envelopes built using `Covery\Client\Envelopes\Builder` (don't forget to invoke `build()`!)

Results
-------

[](#results)

1. `sendEvent` will return `integer` (may be x64) containing ID of a stored entity on Covery side. You should log it.
2. `makeDecision` will return `Covery\Client\Result` object:
    - Call `getScore()` to obtain score in range \[-100, 100\]
    - Method `isAccept()` will return `true` if Covery did not found fraud in incoming envelope data
    - Method `isReject()` will return `true` if Covery found fraud in incoming envelope data

Exception Tree
--------------

[](#exception-tree)

- `Covery\Client\Exception` - base exception
    - `Covery\Client\EnvelopeValidationException` - thrown if envelope failed client side validation
    - `Covery\Client\DeliveredException` - exception delivered for Covery server
        - `Covery\Client\AuthException` - authorization exception
    - `Covery\Client\IoException` - server communication error
        - `Covery\Client\TimeoutException` - timeout

Error loggers
-------------

[](#error-loggers)

- `\Covery\Client\Loggers\VarDumpLogger` - simple var\_dump logger
- `\Covery\Client\Loggers\FileLogger` - writing errors to a file
- You can also write your own logger class extended from AbstractLogger

Changelog
---------

[](#changelog)

- `1.6.0`
    - The minimum PHP version has been changed from 7.3 to 8.0.
    - Updated package psr/log to 3.0.
    - Updated package symfony/yaml to ^5.4 || ^6.4 to support both Symfony 5.4 and 6.4 branches.
- `1.5.3`
    - Added optional `deepfake` and `deepfake_confidence` fields for document event
- `1.5.2`
    - Fixed validation of `second_user_merchant_id` field for the "Transfer" event
- `1.5.1`
    - Change the data type of the field `language_browser` from `string(255)` to `string(1024)`
    - Change the data type of the field `product_quantity` from `int` to `float` for the "Order Item" event
    - Add the possibility to send zero in the following fields: `amount`, `amount_converted`, `shipping_fee`, `shipping_fee_converted`,
        `source_fee`, `source_fee_converted`, `tax_fee`, `tax_fee_converted`,
        `transaction_amount`, `transaction_amount_converted`, `refund_amount`, `refund_amount_converted`,
        `payout_amount`, `payout_amount_converted`, `one_operation_limit`,
        `daily_limit`, `weekly_limit`, `monthly_limit`, `annual_limit`
- `1.5.0`
    - The minimum PHP version has been changed from 5.4 to 7.3.
    - Packages have been updated.
    - Old tests modified
- `1.4.1`
    - Added optional `mrz_authority` and `mrz_issue_date` fields for document event
- `1.4.0`
    - **Removed transaction\_id field from postback event**
    - Renamed MediaStorage method to DocumentMethod
    - Renamed MediaConnection method to DocumentConnection
    - Renamed UploadMediaFile method to DocumentMediaFile.
    - Renamed `media_id` field to `document_id`
    - Added optional `merchant_advice_code` and `merchant_advice_text` fields for postback event
    - Added optional `anonymous` field for kyc\_submit, profile\_update events
    - Changed length field `plugins` to `8192`
    - New `document` event introduced
    - Old tests modified
- `1.3.14` Added MediaStorage method. Added MediaConnection method. Added UploadMediaFile method.
    - Added optional `media_id` field for events: install, registration, confirmation, login, order-item, order-submit, transaction, refund, payout, transfer, profile-update, kyc-profile, kyc-submit.
    - Added optional address\_confirmed, second\_address\_confirmed fields for KYC profile and KYC submit events.
    - Added AccountConfigurationStatus method.
    - Removed Health check method.
- `1.3.13` Added StaleDataException exception
- `1.3.12` Added sendCardId method
- `1.3.11` Added VarDumpLogger and FileLogger
- `1.3.10`
    - Removed the limit on the number of custom fields in the request
- `1.3.9`
    - Added optional `provider_id`, `profile_id`, `profile_type`, `profile_sub_type`, `firstname`, `lastname`, `fullname`, `gender`, `industry`, `wallet_type`, `website_url`, `description`, `employment_status`, `source_of_funds`, `birth_date`, `reg_date`, `issue_date`, `expiry_date`, `reg_number`, `vat_number`, `email`, `email_confirmed`, `phone`, `phone_confirmed`, `contact_email`, `contact_phone`, `country`, `state`, `city`, `address`, `zip`, `nationality`, `second_country`, `second_state`, `second_city`, `second_address`, `second_zip`, `ajax_validation`, `cookie_enabled`, `cpu_class`, `device_fingerprint`, `device_id`, `do_not_track`, `ip`, `real_ip`, `local_ip_list`, `language`, `languages`, `language_browser`, `language_user`, `language_system`, `os`, `screen_resolution`, `screen_orientation`, `client_resolution`, `timezone_offset`, `user_agent`, `plugins`, `referer_url`, `origin_url` fields for kyc\_submit event.
- `1.3.8`
    - Added optional `links_to_documents` field for transaction, refund, payout, transfer, profile\_update, kyc\_profile and kyc\_submit events
- `1.3.7`
    - Added `profile_update` event
- `1.3.6`
    - Added optional `allowed_document_format` field for kyc\_start event.
- `1.3.5`
    - Added optional `second_user_merchant_id` field for transfer event
- `1.3.4`
    - Added optional `number_of_documents` field for kyc\_start event.
    - Added `kyc_proof` event
- `1.3.3`
    - Added optional `provider_id`, `contact_email`, `contact_phone`, `wallet_type`, `nationality`, `final_beneficiary`, `employment_status`, `source_of_funds`, `issue_date`, `expiry_date`, `gender` fields for kyc\_profile event.
    - Added `kyc_start` event.
- `1.3.2`
    - Added optional `merchant_country`, `mcc`, `acquirer_merchant_id` fields for transaction event. Added optional `group_id` field for install, registration, confirmation, login, transaction, refund, payout and transfer events
- `1.3.1`
    - Added `order_item`, `order_submit` events. Added optional `transfer_source` field for transfer event
- `1.3.0`
    - Added optional `campaign` field for login, registration, install and transaction events
- `1.2.0`
    - Added support for request timeouts
- `1.1.9`
    - Added optional `bic` field for transfer event
- `1.1.8`
    - Added slash before request path (guzzle deprecation since version 1.4)
- `1.1.7`
    - Added `kyc_profile`, `kyc_submit` events
- `1.1.6`
    - Added decision response fields: `type`, `createdAt`, `sequenceId`, `merchantUserId`, `reason`, `action` and custom response
- `1.1.5`
    - Postback request\_id change type to `int`
- `1.1.4`
    - Malformed error for empty postback response
- `1.1.3`
    - Postback request with request\_id or transaction\_id
- `1.1.2`
    - added sendPostback method to send posback events
- `1.1.1`
    - added optional `password` for login, registration events
    - added optional `iban`, `second_iban` for transfer event
- `1.1.0`
    - added optional `local_ip_list`, `plugins`, `referer_url`, `origin_url`, `client_resolution` for browser data
    - added optional `email`, `phone`, `user_merchant_id` for refund event
- `1.0.9`
    - new `transfer` event introduced
- `1.0.8`
    - added optional `traffic_source` and `affiliate_id` for login event
- `1.0.7`
    - custom fields validation fixed
- `1.0.6`
    - string validation actualized
- `1.0.5`
    - new `postback` event introduced
    - added optional `gender` for login event
    - added optional `payout_account_id` for payout event
    - `payout_card_id`, `payout_ammount_converted` moved to optional for payout event
    - added optional `affiliate_id` for transaction event
    - added optional `refund_method`, `refund_system`, `refund_mid` for refund event
    - added `device_id` to all packets
    - tests for `postback` event added
    - old tests modified
- `1.0.4`
    - new `install`, `refund` events introduced
    - `transaction_mode` moved to optional for transaction event
    - added mandatory `user_merchant_id` for transaction event
    - tests for `install`, `refund`, `transaction` events added
    - payout test fixed
- `1.0.3`
    - new `payout` event introduced
    - identity nodes are optional now
    - new experimental `PersistentCurl` transport for workers
- `1.0.2` cURL issue with status code 100 fixed
- `1.0.1`
    - added optional `email` and `phone` to confirmation event
    - added more optional fields to all packets: `ajax_validation`, `cookie_enabled`, `cpu_class`, `device_fingerprint`, `do_not_track`, `ip`, `language`, `language_browser`, `language_system`, `language_user`, `languages`, `os`, `real_ip`, `screen_orientation`, `screen_resolution`, `timezone_offset`, `user_agent`
- `1.0.0` - release

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance76

Regular maintenance activity

Popularity33

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~74 days

Recently: every ~89 days

Total

46

Last Release

132d ago

PHP version history (3 changes)1.0.0-alphaPHP &gt;=5.4

1.5.0PHP &gt;=7.3

1.6.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b277c1be46ee2c8c9bf4c285a35a29983bc2e4d540c6c858fcc232d8e519bdc?d=identicon)[Maxpay](/maintainers/Maxpay)

---

Top Contributors

[![gotterdemarung](https://avatars.githubusercontent.com/u/2094324?v=4)](https://github.com/gotterdemarung "gotterdemarung (50 commits)")[![avostrovskyi1989](https://avatars.githubusercontent.com/u/49754044?v=4)](https://github.com/avostrovskyi1989 "avostrovskyi1989 (29 commits)")[![yorik1980](https://avatars.githubusercontent.com/u/4066115?v=4)](https://github.com/yorik1980 "yorik1980 (21 commits)")[![kolesniks](https://avatars.githubusercontent.com/u/24718542?v=4)](https://github.com/kolesniks "kolesniks (2 commits)")[![sergeykolesnik](https://avatars.githubusercontent.com/u/30694776?v=4)](https://github.com/sergeykolesnik "sergeykolesnik (2 commits)")[![coverydevteam](https://avatars.githubusercontent.com/u/167742907?v=4)](https://github.com/coverydevteam "coverydevteam (1 commits)")[![mayko64](https://avatars.githubusercontent.com/u/3314111?v=4)](https://github.com/mayko64 "mayko64 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/covery-client/health.svg)

```
[![Health](https://phpackages.com/badges/covery-client/health.svg)](https://phpackages.com/packages/covery-client)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)

PHPackages © 2026

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