PHPackages                             webparking/logic4-client - 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. webparking/logic4-client

ActiveLibrary

webparking/logic4-client
========================

A package to connect with Logic4

v3.1.8(3mo ago)65.0k↓45%2[3 PRs](https://github.com/webparking/logic4-client/pulls)MITPHPPHP ^8.1CI passing

Since Nov 1Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/webparking/logic4-client)[ Packagist](https://packagist.org/packages/webparking/logic4-client)[ RSS](/packages/webparking-logic4-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (41)Used By (0)

[![Header image](./assets/webparking_logic4_client.png)](./assets/webparking_logic4_client.png)

[![Packagist](https://camo.githubusercontent.com/88959831d969422bd797fed6c63001b5d87be1ac242549cbf4f4330ff4fdd0b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7765627061726b696e672f6c6f676963342d636c69656e742e7376673f7374796c653d666c61742d726f756e64266c6f676f3d7061636b6167697374)](https://camo.githubusercontent.com/88959831d969422bd797fed6c63001b5d87be1ac242549cbf4f4330ff4fdd0b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7765627061726b696e672f6c6f676963342d636c69656e742e7376673f7374796c653d666c61742d726f756e64266c6f676f3d7061636b6167697374)[![License](https://camo.githubusercontent.com/d65c240f1c19fdb47b5209a10d33cf2db4d67aef0247cb58d0fb21295533a347/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7765627061726b696e672f6c6f676963342d636c69656e742e7376673f7374796c653d666c61742d726f756e64)](https://camo.githubusercontent.com/d65c240f1c19fdb47b5209a10d33cf2db4d67aef0247cb58d0fb21295533a347/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7765627061726b696e672f6c6f676963342d636c69656e742e7376673f7374796c653d666c61742d726f756e64)[![Github stars](https://camo.githubusercontent.com/fbb3a5d2fcd4611142aa5ed07585f1b747aeae3c32f96ca1600cc3080bee6446/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f7765627061726b696e672f6c6f676963342d636c69656e743f7374796c653d666c61742d726f756e64266c6f676f3d676974687562)](https://camo.githubusercontent.com/fbb3a5d2fcd4611142aa5ed07585f1b747aeae3c32f96ca1600cc3080bee6446/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f7765627061726b696e672f6c6f676963342d636c69656e743f7374796c653d666c61742d726f756e64266c6f676f3d676974687562)[![Downloads](https://camo.githubusercontent.com/e189eb162ddf7992bb58c13582d5ee8323d5943e37c087d0bd688dfc7d19479a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7765627061726b696e672f6c6f676963342d636c69656e742e7376673f7374796c653d666c61742d726f756e64)](https://camo.githubusercontent.com/e189eb162ddf7992bb58c13582d5ee8323d5943e37c087d0bd688dfc7d19479a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7765627061726b696e672f6c6f676963342d636c69656e742e7376673f7374796c653d666c61742d726f756e64)

Logic4 client
=============

[](#logic4-client)

Please note that this API client is not created or maintained by Logic4. For questions about Logic4 or it's API please contact Logic4 support.

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

[](#installation)

You can install the package via composer:

```
composer require webparking/logic4-client
```

Configuration
-------------

[](#configuration)

In order to use the Logic4 API, you need to configure the `AccessTokenManager` with your credentials. You can do this by calling the `configure` method on the `AccessTokenManager` instance.

The following configuration options are required

- `public_key` - The public key of your Logic4 account
- `company_key` - The company key of your Logic4 account
- `username` - The username of your Logic4 account
- `secret_key` - The secret key of your Logic4 account
- `password` - The password of your Logic4 account
- `administration_id` - The administration id of your Logic4 account

The access token is automatically refreshed when it expires and stored in the cache. The cache object is set using the `$cache` property on the `AccessTokenManager` class and should implement the `Psr\SimpleCache\CacheInterface` interface.

After configuring the `AccessTokenManager` you can use any request class in your application without having to worry about the access token and other middleware.

### Example configuration

[](#example-configuration)

```
# In this example, we load the configuration from a .env file.
$dotEnv = Dotenv\Dotenv::createImmutable(__DIR__);
$credentials = $dotEnv->load()

# We use the ArrayStore for testing purposes, but you can use any cache implementation that implements the Psr\SimpleCache\CacheInterface interface.
$cache = new \Illuminate\Cache\Repository(new \Illuminate\Cache\ArrayStore());

$tokenManager = new \Webparking\Logic4Client\AccessTokenManager($cache);
$tokenManager->configure($credentials);

# Initialize the ClientFactory using the AccessTokenManager
$clientFactory = new \Webparking\Logic4Client\ClientFactory($tokenManager);

# Initialize the request class using the ClientFactory
$request = new \Webparking\Logic4Client\Requests\ProductRequest($clientFactory);
$request->getProducts([
    'DebtorId' => 1,
]);
```

Laravel integration
-------------------

[](#laravel-integration)

Integration with Laravel is easily done by configuring the `AccessTokenManager` after it has been resolved by the Laravel IoC Container.

Add the following code to your `AppServiceProvider` class:

```
use Webparking\Logic4Client\AccessTokenManager;

$this->app
    ->afterResolving(AccessTokenManager::class, fn (AccessTokenManager $tokenManager) => $tokenManager->configure([
        'public_key' => config('services.logic4.public_key'),
        'company_key' => config('services.logic4.company_key'),
        'username' => config('services.logic4.username'),
        'secret_key' => config('services.logic4.secret_key'),
        'password' => config('services.logic4.password'),
        'administration_id' => config('services.logic4.administration_id'),
    ]));
```

This makes it possible to directly use any request class in your application without having to worry about the access token and other middleware.

### Example request

[](#example-request)

```
use Webparking\Logic4Client\Requests\ProductRequest;
use Webparking\Logic4Client\Data\Product;
use Illuminate\Support\Collection;

/** @return array */
public function index(ProductRequest $productRequest, int $debtorId): array
{
    $products = $productRequest->getProducts([
        'DebtorId' => $debtorId,
    ]);

    return iterator_to_array($products);
}
```

Testing
-------

[](#testing)

You can test the package by running `./vendor/bin/phpunit` in the root of the project. Make sure install the dependencies by running `composer install` before running the tests.

```
composer install
./vendor/bin/phpunit
```

### Preventing stray requests

[](#preventing-stray-requests)

If you would like to ensure that all requests sent via the client have been mocked throughout your individual test or complete test suite, you can call the `preventStrayRequests` method on the `\Webparking\Logic4Client\ClientFactory` class. After calling this method, any requests that do not have a corresponding mock will throw an exception rather than making the actual request:

```
// turns on stray request prevention
\Webparking\Logic4Client\ClientFactory::preventStrayRequests();

// an exception is thrown if the request is not mocked
$request->getProducts(['DebtorId' => 1]);

// turns off stray request prevention
\Webparking\Logic4Client\ClientFactory::preventStrayRequests(false);

// no exception is thrown and will make the actual request
$request->getProducts(['DebtorId' => 1]);
```

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

[](#contributing)

Please report any issue you find in the issues page. Pull requests are more than welcome.

### Generating endpoints

[](#generating-endpoints)

The endpoints can automatically be generated using the `generate` command. This command will generate a request class for each endpoint and a client class that can be used to instantiate the request classes.

```
make generate
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance82

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~35 days

Total

31

Last Release

101d ago

Major Versions

v1.0.0 → v2.0.02023-11-06

v2.3.1 → v3.0.02024-06-25

v2.3.2 → v3.1.82026-02-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/b33f37a8af0acfeb8638db0a878dacb65b721a2494d0adcc24ed88ff4da05b33?d=identicon)[JeroenVanOort](/maintainers/JeroenVanOort)

![](https://www.gravatar.com/avatar/b2ba83bba40afaac63a77bfe00c4f1ef32eefc977c6d463f803e3a38fc600b2e?d=identicon)[rubenwebparking](/maintainers/rubenwebparking)

---

Top Contributors

[![rubenwebparking](https://avatars.githubusercontent.com/u/129493269?v=4)](https://github.com/rubenwebparking "rubenwebparking (26 commits)")[![lreijmer](https://avatars.githubusercontent.com/u/132908227?v=4)](https://github.com/lreijmer "lreijmer (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (17 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![lightluke](https://avatars.githubusercontent.com/u/1070546?v=4)](https://github.com/lightluke "lightluke (6 commits)")[![avanravels](https://avatars.githubusercontent.com/u/104146659?v=4)](https://github.com/avanravels "avanravels (3 commits)")[![pieterwebparking](https://avatars.githubusercontent.com/u/128715814?v=4)](https://github.com/pieterwebparking "pieterwebparking (1 commits)")

---

Tags

clientlogic4phpwebparking

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webparking-logic4-client/health.svg)

```
[![Health](https://phpackages.com/badges/webparking-logic4-client/health.svg)](https://phpackages.com/packages/webparking-logic4-client)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[ashallendesign/laravel-exchange-rates

A wrapper package for interacting with the exchangeratesapi.io API.

485677.8k](/packages/ashallendesign-laravel-exchange-rates)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[concrete5/core

Concrete core subtree split

19159.3k48](/packages/concrete5-core)

PHPackages © 2026

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