PHPackages                             atanenl/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. [API Development](/categories/api)
4. /
5. atanenl/twinfield

ActiveLibrary[API Development](/categories/api)

atanenl/twinfield
=================

Library for using the Twinfield Soap Service.

0.1.5(9y ago)047.4k2[1 PRs](https://github.com/AtaneNL/twinfield/pulls)GPLPHPPHP &gt;=5.4

Since Mar 27Pushed 8y ago3 watchersCompare

[ Source](https://github.com/AtaneNL/twinfield)[ Packagist](https://packagist.org/packages/atanenl/twinfield)[ Docs](http://atane.nl)[ RSS](/packages/atanenl-twinfield/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (18)Used By (0)

Twinfield [![Build Status](https://camo.githubusercontent.com/6bf6b4a01c33b949e258f74ecfed3bb9a8395bfabc9afbf1487af3c078f86daf/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f70726f6e616d69632f7477696e6669656c642e706e673f6272616e63683d646576656c6f70)](http://travis-ci.org/pronamic/twinfield)
==============================================================================================================================================================================================================================================================================================================

[](#twinfield--)

A PHP library for Twinfield Integration. Developed by [Remco Tolsma](http://remcotolsma.nl/) and [Leon Rowland](http://leon.rowland.nl/) from [Pronamic](http://pronamic.nl/). Use the Twinfield SOAP Service to have your PHP application communicate directly with your Twinfield account.

---

Autoloading
-----------

[](#autoloading)

The classes follow the PSR2 naming convention.

Usage
-----

[](#usage)

### General Usage Information

[](#general-usage-information)

Components will have Factories to simplify the request and send process of Twinfield. Each factory will require just the \\Pronamic\\Twinfield\\Secure\\Config() class with the filled in details.

An example of the usage of the Configuration class.

```
$config = new \Pronamic\Twinfield\Secure\Config();
$config->setCredentials('Username', 'Password', 'Organization', 'Office');
```

- or, when using OAuth:

```
$config = new \Pronamic\Twinfield\Secure\Config();
$config->setOAuthParameters('clientID', 'clientSecret', 'returnURL', 'Organization', 'Office', true);
//the true parameter at the end tells the system to automatically redirect to twinfield to login
```

Now, to the current modules

In the following example, we will use the Customer component as showcase. Although this will be the method for all components ( including Invoice currently )

Typically it is as follows, if using the Factories

- Add/Edit: Make Object, Make Factory, Give object in Submit method of related factory.
- Retrieve: Make Factory, Supply all required params to respective listAll() and get() methods

#### Add/Edit

[](#addedit)

Make your Customer object

```
$customer = new \Pronamic\Twinfield\Customer\Customer();
$customer
	->setID(10666)
	->setName('Leon Rowland')
	->setType('DEB')
	->setWebsite('http://leon.rowland.nl')
	->setEBilling(true)
	->setEBillMail('leon@rowland.nl')
	->setVatCode('VL')
	->setDueDays(10)
	->setCocNumber('12341234');
```

Customers can have addresses associated with them

```
$customerAddress = new \Pronamic\Twinfield\Customer\CustomerAddress();
$customerAddress
	->setDefault(false)
	->setType('invoice')
	->setField1('Testing field 1')
	->setField2('Testing field 2')
	->setField3('Testing field 3')
	->setPostcode('1212 AB')
	->setCity('TestCity')
	->setCountry('NL')
	->setTelephone('010-12345')
	->setFax('010-1234')
	->setEmail('test@email.com');
```

Assign that address to the customer

```
$customer->addAddress($customerAddress);
```

Now lets submit it!

```
use \Pronamic\Twinfield\Customer as TwinfieldCustomer;

// Config object prepared and passed to the CustomerFactory
$customerFactory = new TwinfieldCustomer\CustomerFactory($config);

//$customer = new TwinfieldCustomer\Customer();

// Attempt to send the Customer document
if($customerFactory->send($customer)){
	// Use the Mapper to turn the response back into a TwinfieldCustomer\Customer
	$successfulCustomer = TwinfieldCustomer\Mapper\CustomerMapper::map($customerFactory->getResponse());
}
```

#### Retrieve/Request

[](#retrieverequest)

You can get all customers or get a single one currently.

```
use \Pronamic\Twinfield\Customer as TwinfieldCustomer;

// Config object prepared and passed into the CustomerFactory
$customerFactory = new TwinfieldCustomer\CustomerFactory($config);

$customers = $customerFactory->listAll();
```

At the moment, listAll will return an array of just name and short name.

```
$customer = $customerFactory->get('customerCode', 'office[optional]');
```

The response from get() will be a \\Pronamic\\Twinfield\\Customer\\Customer object.

#### Notes

[](#notes)

Advanced documentation coming soon. Detailing usage without the Factory class. Giving you more control with the response and data as well as more in-depth examples and usage recommendations.

Contribute
----------

[](#contribute)

You can contribute to the development of this project. Try and keep to the way of doing things as the other 2 components have implemented.

A large requirement is to maintain backwards compatibility so if you have any plans for large restructure or alteration please bring up in an issue first.

Componentget()listAll()send()MapperNamespace[Customer](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/Customers)✅✅✅✅[Pronamic/Twinfield/Customer](https://github.com/pronamic/twinfield/tree/develop/src/Pronamic/Twinfield/Customer)[Project](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/Projects)✅✅✅✅[Pronamic/Twinfield/Project](https://github.com/pronamic/twinfield/tree/develop/src/Pronamic/Twinfield/Project)[Sales Invoices](https://c1.twinfield.com/webservices/documentation/#/ApiReference/SalesInvoices)✅✅✅✅[Pronamic/Twinfield/Invoice](https://github.com/pronamic/twinfield/tree/develop/src/Pronamic/Twinfield/Invoice)Transactions: [Purchase](https://c1.twinfield.com/webservices/documentation/#/ApiReference/PurchaseTransactions)✅
[browse code 020](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Request/BrowseData)✅[Pronamic/Twinfield/PurchaseInvoice](https://github.com/pronamic/twinfield/tree/develop/src/Pronamic/Twinfield/PurchaseInvoice)Transactions: [Sale](https://c1.twinfield.com/webservices/documentation/#/ApiReference/SalesTransactions)✅[Pronamic/Twinfield/Transaction](https://github.com/pronamic/twinfield/tree/develop/src/Pronamic/Twinfield/Transaction)[Articles](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/Articles)Pronamic/Twinfield/Article[Balance Sheets](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/BalanceSheets)Pronamic/Twinfield/BalanceSheet[Suppliers](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/Suppliers)Pronamic/Twinfield/Supplier[Dimension Groups](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/DimensionGroups)Pronamic/Twinfield/Dimension/Group[Dimension Types](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/DimensionTypes)✅✅✅✅[Pronamic/Twinfield/DimensionType](https://github.com/pronamic/twinfield/tree/develop/src/Pronamic/Twinfield/DimensionType)[Offices](https://c1.twinfield.com/webservices/documentation/#/ApiReference/Masters/Offices)✅Pronamic/Twinfield/Office[Vat types](https://c3.twinfield.com/webservices/documentation/#/ApiReference/Miscellaneous/Finder)✅Pronamic/Twinfield/VatCodeBuild
-----

[](#build)

- npm install
- composer install

Links
-----

[](#links)

- [Twinfield API Documentation site](https://c1.twinfield.com/webservices/documentation/)
- [Twinfield Library for Python](https://bitbucket.org/vanschelven/twinfield)
- [Using Grunt for PHP](https://chrsm.org/post/using-grunt-for-php/)
- [Using Grunt with PHP Quality Assurance Tools](http://mariehogebrandt.se/articles/using-grunt-php-quality-assurance-tools/)

Authors
-------

[](#authors)

- [Pronamic](http://pronamic.nl/)
- [Remco Tolsma](http://remcotolsma.nl/)
- [Emile Bons](http://www.emilebons.nl)

License
-------

[](#license)

Copyright 2009-2013 Pronamic.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Recently: every ~51 days

Total

15

Last Release

3420d ago

### Community

Maintainers

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

---

Top Contributors

[![zogot](https://avatars.githubusercontent.com/u/493614?v=4)](https://github.com/zogot "zogot (131 commits)")[![remcotolsma](https://avatars.githubusercontent.com/u/869674?v=4)](https://github.com/remcotolsma "remcotolsma (48 commits)")[![o-daan](https://avatars.githubusercontent.com/u/736845?v=4)](https://github.com/o-daan "o-daan (37 commits)")[![NoDiscipline](https://avatars.githubusercontent.com/u/5564740?v=4)](https://github.com/NoDiscipline "NoDiscipline (16 commits)")[![Ma-ve](https://avatars.githubusercontent.com/u/11227996?v=4)](https://github.com/Ma-ve "Ma-ve (8 commits)")[![EmileBons](https://avatars.githubusercontent.com/u/3186640?v=4)](https://github.com/EmileBons "EmileBons (7 commits)")[![arnoutdemooij](https://avatars.githubusercontent.com/u/929767?v=4)](https://github.com/arnoutdemooij "arnoutdemooij (6 commits)")[![mmolhoek](https://avatars.githubusercontent.com/u/39786?v=4)](https://github.com/mmolhoek "mmolhoek (4 commits)")[![simplicate-nl](https://avatars.githubusercontent.com/u/25611148?v=4)](https://github.com/simplicate-nl "simplicate-nl (3 commits)")[![mastercoding](https://avatars.githubusercontent.com/u/306659?v=4)](https://github.com/mastercoding "mastercoding (2 commits)")[![rvanlaarhoven](https://avatars.githubusercontent.com/u/1857585?v=4)](https://github.com/rvanlaarhoven "rvanlaarhoven (1 commits)")[![vswarte](https://avatars.githubusercontent.com/u/6827387?v=4)](https://github.com/vswarte "vswarte (1 commits)")[![NanneHuiges](https://avatars.githubusercontent.com/u/1526794?v=4)](https://github.com/NanneHuiges "NanneHuiges (1 commits)")

---

Tags

twinfield

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23914.2M16](/packages/hubspot-api-client)

PHPackages © 2026

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