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. [Utility &amp; Helpers](/categories/utility)
4. /
5. webparking/logic4-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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

A package to connect with Logic4

v4.0.1(1w ago)66.1k↓38.3%2[3 PRs](https://github.com/webparking/logic4-client/pulls)MITPHPPHP ^8.3CI passing

Since Nov 1Pushed 5d 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 3d ago

READMEChangelog (10)Dependencies (50)Versions (52)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

58

—

FairBetter than 98% of packages

Maintenance99

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity71

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

Recently: every ~34 days

Total

35

Last Release

12d 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

v3.1.9 → v4.0.02026-06-16

PHP version history (2 changes)v1.0.0PHP ^8.1

v4.0.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5616838?v=4)[Jeroen van Oort](/maintainers/JeroenVanOort)[@JeroenVanOort](https://github.com/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] (18 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)")[![jstapelkamp](https://avatars.githubusercontent.com/u/155425627?v=4)](https://github.com/jstapelkamp "jstapelkamp (5 commits)")[![avanravels](https://avatars.githubusercontent.com/u/104146659?v=4)](https://github.com/avanravels "avanravels (3 commits)")[![JeroenVanOort](https://avatars.githubusercontent.com/u/5616838?v=4)](https://github.com/JeroenVanOort "JeroenVanOort (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.8k543.8M20.1k](/packages/laravel-framework)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M991](/packages/statamic-cms)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

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