PHPackages                             comfino/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. [HTTP &amp; Networking](/categories/http)
4. /
5. comfino/php-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

comfino/php-sdk
===============

Comfino PHP SDK - backend routines for e-commerce platforms integration.

1.0.0(3mo ago)0211BSD-3-ClausePHPPHP &gt;=8.1CI failing

Since Apr 17Pushed 1mo agoCompare

[ Source](https://github.com/comfino/php-sdk)[ Packagist](https://packagist.org/packages/comfino/php-sdk)[ Docs](https://github.com/comfino/php-sdk)[ RSS](/packages/comfino-php-sdk/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (10)Versions (3)Used By (1)

[ ![Comfino](assets/comfino_logo.svg)](https://developers.comfino.pl)Comfino PHP SDK
===============

[](#comfino-php-sdk)

[![Latest Version](https://camo.githubusercontent.com/4f796deed8bc40f819997d718fb41d40b7feb7dd520ef7642fbbb1b43d8a1236/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f6d66696e6f2f7068702d73646b2e737667)](https://github.com/comfino/php-sdk/releases)[![PHP Version](https://camo.githubusercontent.com/61185167cad79426761636cce97ed3ef426ac16e6bf2f9829d41b0201b695b5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f636f6d66696e6f2f7068702d73646b2f7068702e737667)](https://packagist.org/packages/comfino/php-sdk)[![Build Status](https://github.com/comfino/php-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/comfino/php-sdk/actions/workflows/tests.yml)[![Software License](https://camo.githubusercontent.com/ba163b9d6a47bcfeeaeeae8a91d4fa1a8df3d528367d69952295f31f2f770cad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d425344253230332d2d436c617573652d6f72616e67652e737667)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/8e90e47b7505e5018756e8e9f2240e2502c264b53f361f7899a9f6a27f219e05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6d66696e6f2f7068702d73646b2e737667)](https://packagist.org/packages/comfino/php-sdk)[![API Documentation](https://camo.githubusercontent.com/b2e7feb6e6f17d534d0fcadc30e1f4d74bd06681abe353feb46bdb3741ea02b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4150492d646f63756d656e746174696f6e2d356139653333)](https://developers.comfino.pl)

**Comfino PHP SDK with backend routines for e-commerce platforms integration**

A complete PHP backend library for integrating any application or e-commerce platform with the Comfino payment gateway API. Whether you are building a custom integration for a closed platform, writing a payment plugin for an open-source e-commerce system, or embedding Comfino financing into your own application, this SDK provides all the backend building blocks you need.

The library covers the full integration lifecycle: API communication, secure webhook handling, configuration management, payment product filtering, category-based eligibility checks, and frontend widget support. All integration points are defined as interfaces, so the SDK adapts to any PHP application stack without imposing a concrete HTTP client, logger, or cache implementation.

> **Lightweight integration?** If you only need the HTTP API layer — requests, responses, DTOs, retry, and auth — without the full plugin infrastructure, you can depend directly on the lower-level package:
>
> ```
> composer require comfino/php-api-client
> ```
>
>
>
> `comfino/php-api-client` is the standalone API client that this SDK builds upon. It ships the PSR-18 HTTP client, all request/response classes, error types, and the webhook signature verifier, but nothing else. See the [php-api-client documentation](https://github.com/comfino/php-api-client#readme) for details.

Features
--------

[](#features)

- PSR-18 HTTP Client / PSR-7 Messages / PSR-17 Factories support.
- PSR-6 cache and PSR-3 logging interfaces.
- Production and sandbox environment support.
- Exponential backoff retry for transient API errors.
- Secure webhook handling with CR-Signature (SHA3-256) verification.
- Configuration manager with a pluggable storage adapter.
- Payment product type filter chain based on cart value and category.
- Hierarchical category tree with ancestor/descendant traversal.
- Frontend helpers for widget init script and paywall logo authentication.

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

[](#requirements)

- PHP 8.1 or higher
- Extensions: `ext-json`, `ext-sodium`, `ext-zlib`
- PSR-18 HTTP Client and PSR-17 HTTP Factories implementations
- Composer

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

[](#installation)

```
composer require comfino/php-sdk
```

Suggested companion packages:

```
composer require sunrise/http-client-curl                  # PSR-18 cURL client
composer require monolog/monolog                           # PSR-3 logger
composer require cache/filesystem-adapter league/flysystem # PSR-6 filesystem cache
```

Quick start
-----------

[](#quick-start)

```
use Comfino\Backend\Factory\ApiClientFactory;
use Comfino\Backend\Factory\OrderFactory;
use Comfino\Enum\LoanType;

// 1. Create the API client.
$client = (new ApiClientFactory())->createClient(
    httpClient: $httpClient,
    requestFactory: $requestFactory,
    streamFactory: $streamFactory,
    apiKey: 'your-api-key'
);

// 2. Build an order.
$order = (new OrderFactory())->createOrder(
    orderId: 'ORDER-123',
    orderTotal: 150000, // in cents/grosz
    deliveryCost: 1500, // in cents/grosz
    loanTerm: 12, // months
    loanType: LoanType::INSTALLMENTS_ZERO_PERCENT,
    cartItems: $cartItems,
    customer: $customer,
    returnUrl: 'https://my-shop.com/order/confirm',
    notificationUrl: 'https://my-shop.com/comfino/webhook/status'
);

// 3. Submit the loan application.
$response = $client->createOrder($order);
header('Location: ' . $response->applicationUrl);
```

Documentation
-------------

[](#documentation)

TopicGuideArchitecture, design patterns, namespace map[docs/architecture.md](docs/architecture.md)API client: all operations, error handling, retry[docs/api-client.md](docs/api-client.md)Building order, cart and customer objects[docs/order-and-cart.md](docs/order-and-cart.md)Webhook handling and custom endpoints[docs/webhooks.md](docs/webhooks.md)Configuration management[docs/configuration.md](docs/configuration.md)Payment filtering and category tree[docs/payment-filtering.md](docs/payment-filtering.md)Standalone API client (lightweight integration)[comfino/php-api-client](https://github.com/comfino/php-api-client#readme)Development
-----------

[](#development)

The `bin/` wrappers delegate to Docker containers when `docker-compose` is available, or fall back to the host PHP. Two containers are used:

- **`php-sdk`** — standard container, no Xdebug. Start it once with `docker-compose up -d`.
- **`php-sdk-coverage`** — built with Xdebug (`XDEBUG_MODE=coverage`). Started on demand automatically by `bin/phpunit` whenever a `--coverage*` flag is detected; no manual `up` needed.

```
# Start the standard development container.
docker-compose up -d

# Install dependencies.
./bin/composer install

# Run all tests.
./bin/composer test

# Run unit tests only.
./bin/phpunit --testsuite Unit

# Run integration tests against the sandbox (requires a sandbox API key).
COMFINO_SANDBOX_API_KEY=your-key ./bin/phpunit --testsuite Integration

# Generate HTML coverage report (Xdebug container starts automatically).
./bin/phpunit --coverage-html coverage

# Check PSR-12 code style.
./bin/composer cs

# Auto-fix PSR-12 violations.
./bin/composer cs-fix

# Run PHPStan static analysis (level 6).
./bin/composer analyse
```

PSR standards
-------------

[](#psr-standards)

- **PSR-4** autoloading
- **PSR-6** cache
- **PSR-7** HTTP messages
- **PSR-17** HTTP factories
- **PSR-18** HTTP client
- **PSR-12** coding style

Changelog
---------

[](#changelog)

See [CHANGELOG](CHANGELOG.md) for recent changes.

License
-------

[](#license)

BSD 3-Clause License. See [LICENSE](LICENSE) for details.

Support
-------

[](#support)

Bug reports and feature requests: [GitHub issue tracker](https://github.com/comfino/php-sdk/issues).

Contributing
------------

[](#contributing)

The [GitHub repository](https://github.com/comfino/php-sdk) is a read-only public mirror that receives automated clean-snapshot releases. Please report bugs and suggest improvements via the [issue tracker](https://github.com/comfino/php-sdk/issues).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance86

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

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

Total

2

Last Release

52d ago

Major Versions

1.0.0 → 2.0.0-beta12026-06-02

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/83001403?v=4)[Artos Rakshasa](/maintainers/akozubskicr)[@akozubskicr](https://github.com/akozubskicr)

---

Top Contributors

[![akozubskicr](https://avatars.githubusercontent.com/u/83001403?v=4)](https://github.com/akozubskicr "akozubskicr (1 commits)")

---

Tags

bnplcomfinoecommerceinstallmentsintegrationpay-laterpayment-gatewaypayment-integrationpaymentsphpsdkpsr-7psr-3apiclientpsr-17sdkpsr-18magentopsr-6paymentgatewayecommercewoocommerceprestashopinstallmentsbnplpay latercomfino

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k373.5M3.4k](/packages/symfony-cache)[api-platform/metadata

API Resource-oriented metadata attributes and factories

295.0M223](/packages/api-platform-metadata)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.4k67.4M267](/packages/nelmio-api-doc-bundle)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k16](/packages/tempest-framework)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28150.5k](/packages/phpro-http-tools)

PHPackages © 2026

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