PHPackages                             leaselinkorg/ll-php-lib - 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. leaselinkorg/ll-php-lib

ActiveLibrary[API Development](/categories/api)

leaselinkorg/ll-php-lib
=======================

PHP library for LeaseLink API integration

1.1.0(2mo ago)04.5k↓47.4%GPL-3.0PHPPHP &gt;=8.1

Since Feb 19Pushed 2mo agoCompare

[ Source](https://github.com/leaselinkOrg/ll-php-lib)[ Packagist](https://packagist.org/packages/leaselinkorg/ll-php-lib)[ Docs](https://github.com/leaselinkorg/ll-php-lib)[ RSS](/packages/leaselinkorg-ll-php-lib/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (2)Versions (7)Used By (0)

LeaseLink PHP Library
=====================

[](#leaselink-php-library)

A PHP library for integrating with the LeaseLink API. This library provides a simple way to create lease calculations and handle responses from the LeaseLink service.

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

[](#requirements)

- PHP 8.1 or higher
- Composer
- cURL extension
- JSON extension

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

[](#installation)

For stable version:

```
composer require leaselinkorg/ll-php-lib
```

For development version:

```
composer require leaselinkorg/ll-php-lib:dev-develop
```

For PHP 7.1+ version:

```
composer require leaselinkorg/ll-php-lib:dev-support/php71
```

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

[](#configuration)

First, create a configuration object with your API credentials:

```
use LeaseLink\Config\LeaseLinkConfig;

$config = new LeaseLinkConfig(
    apiKey: 'your-api-key',
    isTest: true, // Use true for test environment
    debug: true,  // Enable debug logging
    logFile: 'path/to/leaselink.log'
);
```

Basic Usage
-----------

[](#basic-usage)

Here's a basic example of creating a calculation:

```
use LeaseLink\LeaseLinkLib;
use LeaseLink\Service\LeaseLinkApiClient;
use LeaseLink\Model\CalculationItem;
use LeaseLink\Config\CalculationOptions;
use LeaseLink\Service\FileLogger;

// Initialize the client
$logger = new FileLogger('path/to/leaselink.log', true);
$client = new LeaseLinkApiClient($config, $logger);
$leaselink = new LeaseLinkLib($config, $client);

// Create calculation items
$items = [
    new CalculationItem(
        name: 'Laptop Dell XPS 13',
        quantity: 1,
        categoryLevel1: 'Electronics',
        unitNetPrice: 4065.04,
        unitGrossPrice: 5000.00,
        tax: '23',
        unitTaxValue: 934.96,
        categoryLevel2: 'Computers',
        categoryLevel3: 'Laptops'
    )
];

// Set calculation options
$options = new CalculationOptions(
    multiOffer: false,
    email: 'customer@example.com',
    taxId: '1234567890',
    externalOrderId: 'ORDER-123'
);

// Create calculation
try {
    $result = $leaselink->createCalculation($items, $options);

    // Access calculation results
    echo "Calculation ID: " . $result->getCalculationId() . "\n";
    echo "Calculation URL: " . $result->getCalculationUrl() . "\n";

    // Process offers
    foreach ($result->getOffers() as $offer) {
        echo "Offer: {$offer['partnerName']}\n";
        echo "Installments: {$offer['installmentAmount']} x {$offer['numberOfInstallments']}\n";
    }
} catch (LeaseLinkApiException $e) {
    echo "Error: " . $e->getMessage() . "\n";
    print_r($e->getErrors());
}
```

Save Chosen Offer
-----------------

[](#save-chosen-offer)

After creating a calculation, you can get redirect url the chosen offer:

```
// First create calculation
$result = $leaselink->createCalculation($items, $options);

// Get first offer from results
$offer = $result->getOffers()[0];

// Save chosen offer
$savedOffer = $leaselink->saveChosenOffer(
    $result->getCalculationId(),
    $offer['calculationPackageId']
);

// Get redirect URL for customer
$redirectUrl = $savedOffer->getRedirectUrl();
```

See `examples/save-chosen-offer.php` for a complete example.

Available Classes
-----------------

[](#available-classes)

### LeaseLinkConfig

[](#leaselinkconfig)

Configuration class for API settings:

- `apiKey` - Your LeaseLink API key
- `isTest` - Boolean flag for test environment
- `debug` - Enable debug logging
- `logFile` - Path to log file

### CalculationItem

[](#calculationitem)

Represents a single item in the calculation:

- `name` - Product name
- `quantity` - Number of items
- `categoryLevel1` - Main category
- `unitNetPrice` - Net price per unit
- `unitGrossPrice` - Gross price per unit
- `tax` - Tax rate (allowed: 'ZW', '0', '5', '8', '23')
- `unitTaxValue` - Tax value per unit

### CalculationOptions

[](#calculationoptions)

Additional options for calculation:

- `multiOffer` - Show all available financing options
- `email` - Customer email
- `phone` - Customer phone
- `taxId` - Customer tax ID
- `externalOrderId` - Your order reference
- `isCartReadOnly` - Lock cart modifications

Error Handling
--------------

[](#error-handling)

The library uses `LeaseLinkApiException` for error handling. You can access detailed error information:

```
try {
    $result = $leaselink->createCalculation($items, $options);
} catch (LeaseLinkApiException $e) {
    echo $e->getMessage();    // Formatted error message
    print_r($e->getErrors()); // Detailed error array
}
```

Logging
-------

[](#logging)

The library supports PSR-3 compatible loggers. You can use the built-in FileLogger or implement your own:

```
$logger = new FileLogger('path/to/leaselink.log', true);
$client = new LeaseLinkApiClient($config, $logger);
```

Webhook Notifications
---------------------

[](#webhook-notifications)

The library supports handling webhook notifications from LeaseLink:

```
try {
    $rawData = json_decode(file_get_contents('php://input'), true);
    $notification = $leaselink->handleNotification($rawData);

    switch ($notification->getStatus()) {
        case NotificationStatus::PROCESSING:
            // Handle processing status
            break;
        case NotificationStatus::ACCEPTED:
            // Handle accepted status
            break;
        // ... handle other statuses
    }
} catch (LeaseLinkApiException $e) {
    // Handle error
}
```

Available notification statuses:

- `NEW` - New order created
- `PROCESSING` - Order is being processed
- `CANCELLED` - Order was cancelled
- `ACCEPTED` - Order has been accepted
- `SIGN_CONTRACT` - Contract ready for signing
- `PAYMENT_FOR_ASSET` - Payment for asset is required
- `SEND_ASSET` - Asset can be sent
- `BNPL_STATUS_CHANGED` - Buy Now Pay Later status has changed

See `examples/webhook-notification.php` for a complete example.

Examples
--------

[](#examples)

Check the `examples` directory for working examples:

- `basic-usage.php`: Simple configuration and calculation creation
- `usage-with-logger.php`: Advanced usage with logging configuration
- `webhook-notification.php`: Handling webhook notifications from LeaseLink
- `save-chosen-offer.php`: Getting the redirect URL for the chosen offer

To run the examples:

```
php examples/basic-usage.php
php examples/usage-with-logger.php
php examples/webhook-notification.php
php examples/save-chosen-offer.php
```

Remember to update the API key in the examples before running them.

License
-------

[](#license)

GPL-3.0 license

Support
-------

[](#support)

For support, please contact e-mail:

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance83

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Total

4

Last Release

87d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

apiintegrationleaselink

### Embed Badge

![Health badge](/badges/leaselinkorg-ll-php-lib/health.svg)

```
[![Health](https://phpackages.com/badges/leaselinkorg-ll-php-lib/health.svg)](https://phpackages.com/packages/leaselinkorg-ll-php-lib)
```

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[deeplcom/deepl-php

Official DeepL API Client Library

2607.3M114](/packages/deeplcom-deepl-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k409.0k6](/packages/theodo-group-llphant)[temporal/sdk

Temporal SDK

4072.9M25](/packages/temporal-sdk)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.0M219](/packages/api-platform-metadata)[bushlanov-dev/max-bot-api-client-php

Max Bot API Client library

486.3k](/packages/bushlanov-dev-max-bot-api-client-php)

PHPackages © 2026

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