定制 wissemkadri/konnect 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wissemkadri/konnect

Composer 安装命令:

composer require wissemkadri/konnect

包简介

Konnect PHP SDK

README 文档

README

Konnect

The payment solution for Tunisia. Simple, fast, personalized, immediate and for all !

Installation

composer require wissemkadri/konnect

This SDK follows the PSR-18 "HTTP Client" standard, to allow for more interoperability.

It's most likely your framework will handle the dependencies injection for you, if not you can use any implementation of the spec.

The below example uses this two librairies:

composer require guzzlehttp/guzzle nyholm/psr7

SDK Initialization

<?php

include './vendor/autoload.php';

use GuzzleHttp\Client;
use WissemKadri\Konnect\Gateway;
use WissemKadri\Konnect\ApiException;
use Nyholm\Psr7\Factory\Psr17Factory;

// Use this or bring your own implementation
$psr17Factory = new Psr17Factory();
$client = new Client();
$konnect = new Gateway($psr17Factory, $psr17Factory, $client);

// Mandatory
// Retrieve this from your Konnect dashboard
$apiKey = "xxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxx";
$konnect->setApiKey($apiKey);

// By default, the SDK is in sandbox mode.
// To switch to production, use the following
$konnect->setProductionMode();

API

initPayment(array $params)

Creates a new payment request.

See Konnect's documentation for the full description of request and response data.

/**
 * @throws ApiException|\Psr\Http\Client\ClientExceptionInterface
 */
public function initPayment(array $params): array
See usage sample and output
$response = $konnect->initPayment([
    "receiverWalletId" => "5f7a209aeb3f76490ac4a3d1",
    "token" => "TND",
    "amount" => 10000, // millimes
    "type" => "immediate",
    "description" => "payment description",
    "acceptedPaymentMethods" => [
        "wallet",
        "bank_card",
        "e-DINAR"
    ],
    "lifespan" => 10, // minutes
    "checkoutForm" => true,
    "addPaymentFeesToAmount" => true,
    "firstName" => "John",
    "lastName" => "Doe",
    "phoneNumber" => "22777777",
    "email" => "john.doe@gmail.com",
    "orderId" => "1234657",
    "webhook" => "https://merchant.tech/api/notification_payment",
    "theme" => "dark"
]);

var_dump($response);
/**
array(2) {
["payUrl"]=>
string(83) "https://gateway.konnect.network/pay?payment_ref=6392d70408ac861bcea30337&theme=dark"
["paymentRef"]=>
string(24) "6392d70408ac861bcea30337"
}
*/

getPaymentDetails(string $paymentId)

Gets payment details for the specified id.

See Konnect's documentation for the full description of the returned array.

/**
 * @throws ApiException|\Psr\Http\Client\ClientExceptionInterface
 */
public function getPaymentDetails(string $paymentId): array

Exceptions

This SDK throws a \WissemKadri\Konnect\ApiException if there's anything wrong with your call. The exception's errors property will contains the reported errors.

If however, something is wrong with the Konnect server, a PSR-18 exception will be thrown instead.

try {
    $response = $konnect->initPayment([/* ... */]);

    } catch (ApiException $e) {
        // HTTP status code
        echo $e->getCode();
        // HTTP status message
        echo $e->getMessage();
        // Konnect API usage errors
        var_dump($e->errors);

    } catch (\Psr\Http\Client\ClientExceptionInterface $e) {
        // Transport error, something is wrong with the Konnect API, and they're
        // probably already working on that
    }
}

See also

wissemkadri/konnect 适用场景与选型建议

wissemkadri/konnect 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment」 「smt」 「clictopay」 「tunisia」 「konnect」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 wissemkadri/konnect 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wissemkadri/konnect 我们能提供哪些服务?
定制开发 / 二次开发

基于 wissemkadri/konnect 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-06-18