PHPackages                             pronamic/wp-twinfield - 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. pronamic/wp-twinfield

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

pronamic/wp-twinfield
=====================

Twinfield library for WordPress.

23[3 issues](https://github.com/pronamic/wp-twinfield/issues)PHPCI passing

Since May 7Pushed 1w ago1 watchersCompare

[ Source](https://github.com/pronamic/wp-twinfield)[ Packagist](https://packagist.org/packages/pronamic/wp-twinfield)[ RSS](/packages/pronamic-wp-twinfield/feed)WikiDiscussions main Synced 4d ago

READMEChangelogDependenciesVersions (3)Used By (0)

Twinfield library for WordPress
===============================

[](#twinfield-library-for-wordpress)

[![Build Status](https://camo.githubusercontent.com/b8bb58a5fb8b3949f9595db05ee08223146d464af0a87e305d564a32ef90f29d/68747470733a2f2f7472617669732d63692e6f72672f77702d7477696e6669656c642f7477696e6669656c642e737667)](https://travis-ci.org/wp-twinfield/twinfield)[![Coverage Status](https://camo.githubusercontent.com/0622ea48d7d1289b130da0da84952af8f4037f03e5fb1a3bedf9e9c3a49bab86/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f77702d7477696e6669656c642f7477696e6669656c642f62616467652e7376673f6272616e63683d646576656c6f7026736572766963653d676974687562)](https://coveralls.io/github/wp-twinfield/twinfield?branch=develop)

Documentation
-------------

[](#documentation)

- [Twinfield API](https://www.twinfield.nl/api)

Timezone
--------

[](#timezone)

> **Good to know:** The API only uses universal time (UTC). You can check the current time in UTC here:

[https://wktaaeu.my.site.com/nlcommunity/s/article/API-Best-Practices-Keeping-a-shadow-database-with-customers-and-suppliers?language=en\_US](https://wktaaeu.my.site.com/nlcommunity/s/article/API-Best-Practices-Keeping-a-shadow-database-with-customers-and-suppliers?language=en_US)

Examples
--------

[](#examples)

See the [`examples/`](examples) directory for examples of the key client features. You can view them in your browser by running the php built-in web server.

```
$ php -S localhost:8000 -t examples/

```

And then browsing to the host and port you specified (in the above example, `http://localhost:8000`).

Environment variables
---------------------

[](#environment-variables)

```
export TWINFIELD_USER=
export TWINFIELD_PASSWORD=
export TWINFIELD_ORGANISATION=
export TWINFIELD_OFFICE_CODE=
export TWINFIELD_ARTICLE_CODE=
export TWINFIELD_SUBARTICLE_CODE=
export TWINFIELD_CUSTOMER_CODE=
export TWINFIELD_SALES_INVOICE_TYPE=
export TWINFIELD_SALES_INVOICE_NUMBER=

```

Travis CI
---------

[](#travis-ci)

```
travis encrypt TWINFIELD_USER=$TWINFIELD_USER --add env.global
travis encrypt TWINFIELD_PASSWORD=$TWINFIELD_PASSWORD --add env.global
travis encrypt TWINFIELD_ORGANISATION=$TWINFIELD_ORGANISATION --add env.global
travis encrypt TWINFIELD_OFFICE_CODE=$TWINFIELD_OFFICE_CODE --add env.global
travis encrypt TWINFIELD_ARTICLE_CODE=$TWINFIELD_ARTICLE_CODE --add env.global
travis encrypt TWINFIELD_CUSTOMER_CODE=$TWINFIELD_CUSTOMER_CODE --add env.global
travis encrypt TWINFIELD_SALES_INVOICE_TYPE=$TWINFIELD_SALES_INVOICE_TYPE --add env.global
travis encrypt TWINFIELD_SALES_INVOICE_NUMBER=$TWINFIELD_SALES_INVOICE_NUMBER --add env.global

```

Debug PHP SOAP
--------------

[](#debug-php-soap)

```
var_dump( $this->get_wsdl_url() );
var_dump( $this->soap_client->__getFunctions() );
var_dump( $this->soap_client->__getTypes() );

try {
	$test = $this->soap_client->Query( $test );
} catch ( \Exception $e ) {
	var_dump( $e );
}

echo "REQUEST:\n" . $this->soap_client->__getLastRequest() . "\n";
```

Plugin
------

[](#plugin)

```
ln -s ~/Projects/wp-twinfield-new  ~/Local\ Sites/twinfield/app/public/wp-content/plugins/pronamic-twinfield

```

To-do
-----

[](#to-do)

```
$client = new Client(
	$client_id,
	$client_secret,
	$redirect_uri
);

$client->set_access_token( ... );

if ( $client->is_access_token_expired() ) {

}

$authentication = {}

$authentication->get_user();

$authentication->get_user()->get_organisation();

$authentication->get_organisation();

$authentication->get_cluster_url();

$authentication->get_organisation()->get_offices();

$client = $authentication->get_client();

$client->get_organisation_service();

$offices = $organisation_service->get_offices();
```

Inspiration
-----------

[](#inspiration)

-
-
-
-
-
-
-
-
-

Design Patterns
---------------

[](#design-patterns)

- [https://en.wikipedia.org/wiki/Interpreter\_pattern](https://en.wikipedia.org/wiki/Interpreter_pattern)

Architecture
------------

[](#architecture)

### REST API

[](#rest-api)

```
/wp-json/pronamic-twinfield/v1/user
/wp-json/pronamic-twinfield/v1/organisation
/wp-json/pronamic-twinfield/v1/authentications/1/organisations
/wp-json/pronamic-twinfield/v1/authentications/1/user
/wp-json/pronamic-twinfield/v1/authentications/1/organisation
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/dimension-types
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/dimensions/DEB/
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/dimensions/DEB/1002
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/declarations
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/periods

```

### Web

[](#web)

```
/twinfield/user
/twinfield/organisation
/twinfield/organisations
/twinfield/organisations/vandermeeracc
/twinfield/organisations/vandermeeracc/offices
/twinfield/organisations/vandermeeracc/offices/66470_A
/twinfield/organisations/vandermeeracc/offices/66470_A/dimension-types
/twinfield/organisations/vandermeeracc/offices/66470_A/declarations
/twinfield/organisations/vandermeeracc/offices/66470_A/periods

/twinfield/... » /wp-json/pronamic-twinfield/v1/...

```

### CLI

[](#cli)

```
wp twinfield user
wp twinfield organisation
wp twinfield ... » /wp-json/pronamic-twinfield/v1/...
wp twinfield bank-statement query $( wp twinfield office list --field=code --user=lookup ) --date_from=2022-01-01 --date_to=2023-01-01 --include_posted=true --user=lookup --pull=true
wp twinfield bank-statement query $( wp twinfield office list --field=code ) --date_from=2020-01-01 --date_to=2021-01-01 --include_posted=true --pull=true
wp twinfield bank-statement query 1000 --date_from=2010-01-01 --date_to=2011-01-01 --include_posted=true
wp twinfield bank-statement query 1000 --date_from=2011-01-01 --date_to=2012-01-01 --include_posted=true
wp twinfield bank-statement query 1000 --date_from=2012-01-01 --date_to=2013-01-01 --include_posted=true
wp twinfield bank-statement query $( wp twinfield office list --field=code --exclude=NL001,NLLEEG,ZESJAB,ZESJAB2 ) --date_from=2022-01-01 --date_to=2023-01-01 --include_posted=true --pull=true
wp twinfield bank-statement query $( wp twinfield office list --field=code --exclude=NL001,NLLEEG,ZESJAB,ZESJAB2 ) --date_from="midnight -1 week" --date_to=midnight --include_posted=true --pull=true

```

### Queries

[](#queries)

```
SELECT
	DATE_FORMAT( bank_statement.date, '%Y-%m' ),
	COUNT( bank_statement.id )
FROM
	wp_twinfield_bank_statements AS bank_statement
GROUP BY
	DATE_FORMAT( bank_statement.date, '%Y-%m' )
;

```

### Config

[](#config)

```
define( 'PRONAMIC_TWINFIELD_CLIENT_ID', , '' );
define( 'PRONAMIC_TWINFIELD_CLIENT_SECRET', '' );
define( 'PRONAMIC_TWINFIELD_REDIRECT_URI', '' );
```

### PSR

[](#psr)

- PSR-7: HTTP message interfaces
- PSR-16: Common Interface for Caching Libraries

Other
-----

[](#other)

-
-
-
-
-
-
-
-

[![Pronamic - Work with us](https://github.com/pronamic/brand-resources/raw/main/banners/pronamic-work-with-us-leaderboard-728x90%404x.png)](https://www.pronamic.eu/contact/)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.7% of commits — single point of failure

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/869674?v=4)[Remco Tolsma](/maintainers/remcotolsma)[@remcotolsma](https://github.com/remcotolsma)

---

Top Contributors

[![remcotolsma](https://avatars.githubusercontent.com/u/869674?v=4)](https://github.com/remcotolsma "remcotolsma (545 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (5 commits)")

### Embed Badge

![Health badge](/badges/pronamic-wp-twinfield/health.svg)

```
[![Health](https://phpackages.com/badges/pronamic-wp-twinfield/health.svg)](https://phpackages.com/packages/pronamic-wp-twinfield)
```

###  Alternatives

[thomascombe/backpack-async-export

This is a package to manage async export in Backpack for Laravel

1528.5k](/packages/thomascombe-backpack-async-export)

PHPackages © 2026

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