PHPackages                             suretly/php7-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. [API Development](/categories/api)
4. /
5. suretly/php7-sdk

ActiveLibrary[API Development](/categories/api)

suretly/php7-sdk
================

PHP SDK for Suretly Lender API

v1.0.6(7y ago)05MITPHPPHP ^7.1.3

Since Jul 2Pushed 7y ago2 watchersCompare

[ Source](https://github.com/SURETLY/PHP7-SDK)[ Packagist](https://packagist.org/packages/suretly/php7-sdk)[ RSS](/packages/suretly-php7-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (9)Used By (0)

Suretly LenderAPI SDK
=====================

[](#suretly-lenderapi-sdk)

PHP7 SDK for Suretly Lender API

Installing LenderAPI SDK
------------------------

[](#installing-lenderapi-sdk)

The recommended way to install LenderAPI SDK is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of LenderAPI SDK:

```
php composer.phar require suretly/lender-api-sdk
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

Use
---

[](#use)

After installing, you need to create a new `Suretly\LenderApi\LenderManager`.

Include LenderManager class

```
use Suretly\LenderApi\LenderManager;
```

You can create SDK from static method:

```
$sdk = LenderManager::create('id', 'token', 'server'):
```

Or you can create a configuration for your connection and create a LenderManager:

```
$config = [
    'id' => '',
    'token' => '',
    'server' => ''
];
$sdk = new LenderManager($config);
```

Calling API methods with SDK
----------------------------

[](#calling-api-methods-with-sdk)

### 1 General methods

[](#1-general-methods)

#### 1.1 Getting parameters for surety search

[](#11-getting-parameters-for-surety-search)

```
$options = $sdk->getOptions();
```

#### \#1.2 Orders list

[](#12-orders-list)

Get orders with parameter `$limit` and optional parameter `$skip`. The limit parameter must be set in the range from 0 to 25.

```
$orders = $sdk->getOrders($limit, $skip);
```

### \#2 Creating and handling orders

[](#2-creating-and-handling-orders)

#### \#2.2 Create surety order

[](#22-create-surety-order)

For a create a new order, you must create a new `Suretly\LenderApi\Model\NewOrder` object.

```
/** @var Suretly\LenderApi\Model\NewOrder $newOrder */
$newOrder = new NewOrder()

// ...
// set data
// ..
```

After, you can add new order on Suretly server with method `postNewOrder`:

```
/** @var string $orderID */
$orderID = $sdk->postNewOrder($newOrder)->id;
```

Method `postNewOrder` return object with 2 fields

```
/** @var object $response */
$response = $sdk->postNewOrder($newOrder);
$orderID = $response->id;
$feeAmount = $response->fee_amount;
```

For example, json data

```
{
    "id": "string"
}
```

#### \#2.3 Get order status

[](#23-get-order-status)

To get the status of the order, run method `getOrderStatus`, which return Suretly\\LenderApi\\Model\\OrderStatus object:

```
$orderStatus = $sdk->getOrderStatus($orderID);
```

For example, json data

```
{
    "id": "string",
    "public": true,
    "sum": 0,
    "cost": 0,
    "bids_count": 0,
    "stop_time": 0,
    "fee_total": 0,
    "fee_paid": 0,
    "payment_link": "string"
}
```

#### \#2.4 Get public Order and public Order Url

[](#24-get-public-order-and-public-order-url)

To get a order, you must call method `getOrder` with parameter `$orderID`:

```
/** @var \Suretly\LenderApi\Model\Order $order */
$order = $sdk->getOrder($orderID);
```

For example, json data for Borrower with russian passport:

```
{
  "id": "string",
  "uid": "string",
  "status": "string",
  "borrower": {
    "name": {
      "first": "string",
      "middle": "string",
      "last": "string",
      "maiden": "string"
    },
    "gender": "string",
    "birth": {
      "date": "string",
      "place": "string"
    },
    "email": "string",
    "phone": "string",
    "profile_url": "string",
    "photo_url": "string",
    "city": "string",
    "identity_document_type": "passport_rf",
    "identity_document": {
      "series": "string",
      "number": "string",
      "issue_date": "string",
      "issue_place": "string",
      "issue_code": "string",
      "registration": {
        "country": "string",
        "zip": "string",
        "area": "string",
        "city": "string",
        "street": "string",
        "house": "string",
        "building": "string",
        "flat": "string",
        "address_line_1": "string",
        "address_line_2": "string"
      },
      "iin": "string",
      "expire_date": "string",
      "ssn": "string",
      "authority": "string"
    },
    "residential": {
      "country": "string",
      "zip": "string",
      "area": "string",
      "city": "string",
      "street": "string",
      "house": "string",
      "building": "string",
      "flat": "string",
      "address_line_1": "string",
      "address_line_2": "string"
    }
  },
  "user_credit_score": 0,
  "cost": "string",
  "loan_sum": "string",
  "loan_term": "string",
  "loan_rate": 0,
  "currency_code": "string",
  "max_wait_time": "string",
  "created_at": "string",
  "modify_at": "string",
  "closed_at": "string",
  "bids_count": "string",
  "bids_sum": "string",
  "callback": "string"
}
```

#### \#2.5 Cancel order

[](#25-cancel-order)

For a cancel the order, you must call method `postOrderStop` with parameter `$orderID`:

```
$sdk->postOrderStop($orderID);
```

#### \#2.6 Get borrower contract

[](#26-get-borrower-contract)

To get a contract for a Borrower, you must call method `getContract` with parameter `$orderID`:

```
/** @var string $contractHTML */
$contractHTML = $sdk->getContract($orderID);
```

Method `getContract` return HTML code:

```
'Contract...'
```

#### \#2.7 Confirm that contract is signed by borrower

[](#27-confirm-that-contract-is-signed-by-borrower)

To confirm that contract is signed by borrower:

```
$sdk->postContractAccept($orderID);
```

#### \#2.8 Confirm that order is paid and issued

[](#28-confirm-that-order-is-paid-and-issued)

To confirm that order is paid and issued:

```
$sdk->postOrderIssued($orderID);
```

### \#2.9 8 Confirm that order is paid

[](#29-8-confirm-that-order-is-paid)

To confirm that order is paid:

```
$sdk->postOrderPaid($orderID);
```

#### \#2.10 Confirm that order is partial paid

[](#210-confirm-that-order-is-partial-paid)

To confirm that order is partial paid:

```
$sdk->postOrderPartialPaid($orderID, $sum);
```

#### \#2.11 Prolong order

[](#211-prolong-order)

To get fee\_amount prolong order, you must run method `getOrderProlong` with parameter `$orderID` and parameter `$days`, which return float value:

```
/** @var float $feeAmount */
$feeAmount = $sdk->getOrderProlong($orderID, $days);
```

For example, json data

```
{
  "fee_amount": 0
}
```

To prolong order, you must call method `postOrderUnpaid`

```
$sdk->postOrderProlong($orderID, $days);
```

#### \#2.13 Upload borrower image

[](#213-upload-borrower-image)

To upload a borrower image, you must call method `postUploadImageOrder` with parameter `$orderID`, parameter `$realPathToFile`, which is realpath to file, and optional parameter `$filename`:

```
$sdk->postUploadImageOrder($orderID, $realPathToFile, $filename);
```

#### \#2.14 Mark loan as overdue

[](#214-mark-loan-as-overdue)

Mark loan as overdue:

```
$sdk->postOrderUnpaid($orderID, $sum);
```

### Dictionaries

[](#dictionaries)

#### Currencies

[](#currencies)

```
/** @var \Suretly\LenderApi\Model\Currency[] $currencies */
$currencies = $sdk->getCurrencies();
```

For example, json data

```
[
    {
      "code": "DE",
      "name": "Germany"
    },
    {
      "code": "FR",
      "name": "France"
    },
    {
      "code": "US",
      "name": "United States of America"
    },
    {
      "code": "RU",
      "name": "Russia"
    },
    {
      "code": "KZ",
      "name": "Казахстан"
    }
]
```

#### Countries

[](#countries)

```
/** @var \Suretly\LenderApi\Model\Country[] $countries */
$countries = $sdk->getCountries();
```

For example, json data

```
[
    {
      "code": "DE",
      "name": "Germany",
      "currency_code": "EUR"
    },
    {
      "code": "FR",
      "name": "France",
      "currency_code": "EUR"
    },
    {
      "code": "US",
      "name": "United States of America",
      "currency_code": "USD"
    },
    {
      "code": "SWE",
      "name": "Sweden",
      "currency_code": "BTC"
    },
    {
      "code": "RU",
      "name": "Russia",
      "currency_code": "RUB"
    },
    {
      "code": "KZ",
      "name": "Казахстан",
      "currency_code": "KZT"
    }
]
```

### \# Work with errors

[](#-work-with-errors)

All SDK methods should use try/catch. For example:

```
try {
    $sdk->postOrderUnpaid($orderID, $sum);
} catch (\Exception $exception) {
    echo $exception->getMessage();
}
```

All SDK methods call ResponseErrorException when an error occurs on the server. You can see all errors in class - `SuretlySDK\Type\ResponseErrorStatusType`.

```
try {
    $sdk->postOrderUnpaid($orderID, $sum);
} catch (\SuretlySDK\Type\ResponseErrorStatusType $exception) {
    echo $exception->getCode() . ': ' . $exception->getMessage();
}
```

Migration
---------

[](#migration)

### version v0.3, v0.4 to v1.0

[](#version-v03--v04-to-v10)

Now, you should use LenderManager instead Suretly.

```
use Suretly\LenderApi\LenderManager;

// create sdk
$sdk = LenderManager::create('id', 'token');
```

Also, all field on Model is private and you should use getters and setters.

```
// create sdk
/** @var Order $order */
$orderId = $order->getId();
```

That's all.

Development
-----------

[](#development)

For run examples test in root project directory run commands

```
cd examples
php example.php
```

For run unit tests in root project directory run command in console

```
/vendor/bin/phpunit
```

For Windows

```
/vendor/bin/phpunit.bat
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Recently: every ~23 days

Total

8

Last Release

2754d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15259622c3b1d2b5563c98ec6392135ebacea0ae2e65366d2e104ba2a49b8d4a?d=identicon)[suretly](/maintainers/suretly)

---

Top Contributors

[![Fafnur](https://avatars.githubusercontent.com/u/3624224?v=4)](https://github.com/Fafnur "Fafnur (17 commits)")

---

Tags

php-sdksuretlylenderAPI

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/suretly-php7-sdk/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[signnow/api-php-sdk

Library to communicate with SignNow API

11138.0k](/packages/signnow-api-php-sdk)[nkl-kst/the-sports-db

PHP library to get sports data from TheSportsDB (https://www.thesportsdb.com)

271.2k](/packages/nkl-kst-the-sports-db)[leapfu/cloud-printer

高扩展性云小票打印SDK，支持飞鹅云、芯烨云、易联云、快递100、映美云、佳博云、中午云、优声云等主流云打印服务，兼容 Laravel、ThinkPHP 等主流框架，统一API，易集成，易扩展。

104.5k](/packages/leapfu-cloud-printer)

PHPackages © 2026

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