PHP code example of zindont / konnektive-api

1. Go to this page and download the library: Download zindont/konnektive-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zindont / konnektive-api example snippets




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
}



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();
}



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',
        ]);
    }
}



use Konnektive\Dispatcher;

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