zindont/konnektive-api

Open-source PHP request wrappers for the current Konnektive CRM API

Maintainers

Package info

github.com/zindont/konnektive-api

Documentation

pkg:composer/zindont/konnektive-api

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-03-31 04:21 UTC

This package is auto-updated.

Last update: 2026-05-01 00:17:11 UTC


README

CI Latest Release PHP ^8.2 License: MIT

Open-source PHP library for sending validated requests to the current Konnektive API documentation.

This package targets the latest public Konnektive collection and ships request wrappers for all 91 documented API endpoints in that collection. Validation rules are loaded from src/Config/request_specs.php, which is the package source of truth for endpoint metadata, HTTP verbs, and request parameters.

Requirements

  • PHP ^8.2
  • ext-curl

Installation

composer require zindont/konnektive-api

What The Package Provides

  • A request class for each documented Konnektive endpoint in the current public docs
  • Request validation before dispatch using illuminate/validation
  • A default cURL handler for live API calls
  • Swappable handlers for tests or custom transport layers
  • Compatibility aliases for legacy request class names
  • PHPUnit coverage that verifies:
    • every documented endpoint has a request class
    • example payloads validate against the current rules
    • dispatcher flow works with a mock handler

Basic Usage

<?php

use Konnektive\Dispatcher;
use Konnektive\Request\Customer\AddCustomerNoteRequest;

$dispatcher = new Dispatcher();

$request = new AddCustomerNoteRequest();
$request->loginId = 'your-login-id';
$request->password = 'your-api-password';
$request->customerId = '123123';
$request->message = 'Created from the PHP package';

$response = $dispatcher->handle($request);

if ($response->isSuccessful()) {
    // Request accepted by Konnektive
}

Validation

Every request is validated before the handler executes. Validation errors throw \Illuminate\Validation\ValidationException.

<?php

use Illuminate\Validation\ValidationException;
use Konnektive\Request\Order\ImportOrderRequest;

$request = new ImportOrderRequest();
$request->loginId = 'your-login-id';
$request->password = 'your-api-password';

try {
    $request->validate();
} catch (ValidationException $exception) {
    $errors = $exception->errors();
}

Custom Handlers

The dispatcher accepts any handler that implements Konnektive\Contracts\IHandler.

<?php

use Konnektive\Contracts\IHandler;
use Konnektive\Request\Request;
use Konnektive\Response\Response;

final class CustomHandler implements IHandler
{
    public function handle(Request $request)
    {
        return new Response([
            'result' => 'SUCCESS',
            'message' => 'Handled externally',
        ]);
    }
}
<?php

use Konnektive\Dispatcher;

$dispatcher = new Dispatcher(new CustomHandler());

Development

Common commands:

composer validate
composer test
composer check

GitHub Actions CI runs the same checks on PHP 8.2, 8.3, and 8.4.

Release Notes

Release flow:

git tag v1.0.0
git push origin v1.0.0

The release workflow will run composer check, then create or update the GitHub release for that tag using the matching CHANGELOG.md section. If no matching version section exists yet, it falls back to Unreleased.

Notes

  • Request rules are driven by the current Konnektive public collection, not by the historical 2018 implementation.
  • If Konnektive changes their public collection, regenerate or update src/Config/request_specs.php and rerun the test suite.
  • Legacy request classes remain available where possible, but validation now prefers the current spec metadata when available.