darvis/mkg-client

Framework-agnostic MKG Software REST API client with optional Laravel integration

Maintainers

Package info

github.com/ArvidDeJong/mkg-client

Homepage

pkg:composer/darvis/mkg-client

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-03-19 08:19 UTC

This package is auto-updated.

Last update: 2026-03-19 08:28:32 UTC


README

Framework-agnostic MKG REST API client with optional Laravel integration.

This API client is intended for MKG ERP: https://www.mkg.eu

It provides a typed service layer for common MKG documents:

  • arti (articles)
  • debi (debtors)
  • cprs (contact persons)
  • vorh (sales order headers)
  • vorr (sales order lines)
  • vopa (sales order line parameters)
  • adrs (addresses)
  • rela (relations)
  • gebr (users)

Documentation

Requirements

  • PHP 8.2+
  • Valid MKG API credentials

For Laravel integration, use Laravel 11, 12, or 13.

Installation

Packagist

composer require darvis/mkg-client

Local path repository

{
  "repositories": {
    "darvis-mkg-client": {
      "type": "path",
      "url": "../Packages/mkg-client"
    }
  },
  "require": {
    "darvis/mkg-client": "*"
  }
}

Then run:

composer update darvis/mkg-client

Laravel: publish package assets

Publish config and CSV metadata:

php artisan vendor:publish --tag=mkg-client

Or publish separately:

php artisan vendor:publish --tag=mkg-config
php artisan vendor:publish --tag=mkg-csv

Quick start

Add to your .env:

MKG_URL_AUTH=https://your-mkg-host/restapi/auth
MKG_URL_PROD=https://your-mkg-host/restapi
MKG_CUSTOMER=your-customer-code
MKG_USERNAME=your-api-username
MKG_PASSWORD=your-api-password

Laravel usage:

use Darvis\MkgClient\Services\DebtorsService;

$service = app(DebtorsService::class);
$rows = $service->findDebtorRowsByNumberNameOrEmail('10001');

Plain PHP usage:

use Darvis\MkgClient\Config\ArrayConfigProvider;
use Darvis\MkgClient\Services\DebtorsService;

$config = new ArrayConfigProvider([
  'mkg.url_auth' => 'https://your-mkg-host/restapi/auth',
  'mkg.url_prod' => 'https://your-mkg-host/restapi',
  'mkg.customer' => 'your-customer-code',
  'mkg.username' => 'your-api-username',
  'mkg.password' => 'your-api-password',
]);

$service = new DebtorsService(config: $config);
$rows = $service->findDebtorRowsByNumberNameOrEmail('10001');

Available services

  • Darvis\MkgClient\Services\ArticleService
  • Darvis\MkgClient\Services\DebtorsService
  • Darvis\MkgClient\Services\ContactpersonService
  • Darvis\MkgClient\Services\OrdersService
  • Darvis\MkgClient\Services\AddressesService
  • Darvis\MkgClient\Services\RelationsService
  • Darvis\MkgClient\Services\UserService

Testing

This package uses Pest.

composer test

Official MKG resources

License

MIT