Download the PHP package picqer/exact-php-client without Composer

On this page you can find all versions of the php package picqer/exact-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package exact-php-client

Exact PHP Client

Run phpunit

PHP client library for the Exact Online API. This client lets you integrate with Exact Online, for example by:

This client uses the same naming and conventions as the Exact API itself, so best way to find out how this client works is by looking at the Exact Online documentation and API reference.

This library is created and maintained by Picqer. We are looking for PHP developers to join our team!

Composer install

Installing this Exact client for PHP can be done through Composer.

Usage

  1. Set up app at Exact App Center to retrieve credentials
  2. Authorize the integration from your app
  3. Parse callback and finish connection set up
  4. Use the library to do stuff

Steps 1 - 3 are only required once on set up.

Set up app at Exact App Center to retrieve credentials

Set up an App at the Exact App Center to retrieve your Client ID and Client Secret. You will also need to set the correct Callback URL for the oAuth dance to work.

Authorize the integration from your app

The code below is an example authorize() function.

This will redirect the user to Exact to login and authorize your integration with their account.

Parse callback and finish connection set up

Exact will redirect back to the callback url you provided. The callback will receive a code param. This is the authorization code for oAuth. Store this code.

Make a new connection to Exact so the library can exchange codes and fetch the accesstoken and refreshtoken. The accesstoken is a temporary token which allows for communication between your app and Exact. The refreshtoken is a token which is used to get a new accesstoken which also refreshes the refreshtoken. The library will settle all of this for you. The code below could be an general connect() function, which returns the api connection.

About divisions (administrations)

By default the library will use the default administration of the user. This means that when the user switches administrations in Exact Online. The library will also start working with this administration.

Rate limits

Exact uses a minutely and daily rate limit. There are a maximum number of calls per day you can do per company, and to prevent bursting they have also implemented a limit per minute. This PR stores this information in the Connection and adds methods to read the rate limits so you can handle these as appropriate for your app. Exact documentation on rate limits is found here: https://support.exactonline.com/community/s/knowledge-base#All-All-DNO-Simulation-gen-apilimits

If you hit a rate limit, an ApiException will be thrown with code 429. At that point you can determine whether you've hit the minutely or the daily limit. If you've hit the minutely limit, try again after 60 seconds. If you've hit the daily limit, try again after the daily reset.

You can use the following methods on the Connection, which will return the limits after your first API call (based on the headers from Exact).

Do note when you have no more minutely calls available, Exact only sends the Minutely Limit headers. So in that case, the Daily Limit headers will remain 0 until the minutely reset rolls over.

There is basic support to sleep upon hitting the minutely rate limits. If you enable "Wait on minutely rate limit hit", the client will sleep until the limit is reset. Daily limits are not considered.

Use the library to do stuff (examples)

Use generators to prevent memory overflow

This package allows you to interact with the Exact API using PHP generators. This may be useful when you're retrieving large sets of data that are too big to load into memory all at once.

Connect to other Exact country than NL

Choose the right base URL according to Exact developers guide

Check src/Picqer/Financials/Exact for all available entities.

Webhooks

Managaging webhook subscriptions is possible through the WebhookSubscription entitiy.

For authenticating incoming webhook calls you can use the Authenticatable trait. Supply the authenticate method with the full JSON request and your Webhook secret supplied by Exact, it will return true or false.

Troubleshooting

'Picqer\Financials\Exact\ApiException' with message 'Error 400: Please add a $select or a $top=1 statement to the query string.'

In specific instances, sadly not documented in the API documentation of Exact this is a requirement. Probably to prevent overflooding requests. What you have to do when encountering this error is adding a select or top. The select is used to provide a list of fields you want to extract, the $top=1 limits the results to one item.

Examples:

Return only the EntryID and FinancialYear.

The $top=1 is added like this:

Authentication error

'Fatal error: Uncaught Exception: Could not connect to Exact: Client error:POST https://start.exactonline.nl/api/oauth2/token resulted in a 400 Bad Request response: Bad Request in /var/www/html/oauth_call_connect.php:61 Stack trace: #0 {main} thrown in /var/www/html/oauth_call_connect.php on line 61`'

This error occurs because the code you get in your redirect URL is only valid for one call. When you call the authentication-process again with a "used" code. You get this error. Make sure you use the provided code by Exact Online only once to get your access token.

Code example

See for example: example/example.php

Guzzle versions

Guzzle 6 and 7 is supported starting from v3. For Guzzle 3 use v1.

TODO


All versions of exact-php-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
guzzlehttp/guzzle Version ~6.0|~7.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package picqer/exact-php-client contains the following files

Loading the files please wait ....