Search by

darvis / snelstart

darvis

Laravel client for the SnelStart B2B API v2 (Dutch accounting software): client key authentication, relations, articles, sales orders and a standalone cURL client.

v1.3.1 2026-09-21 11:22 UTC

README

Latest version Tests PHP version License

A PHP client for the SnelStart B2B API v2, the API of the Dutch accounting software SnelStart. It exchanges your client key for an access token, keeps that token, and sends your calls with the right headers. It has no models, no synchronisation and no webhooks: you call an endpoint and get the decoded response back.

Features

  • Authentication handled - the client key is exchanged for an access token, kept encrypted in Laravel's cache until sixty seconds before it expires
  • One new token after a 401 - when SnelStart refuses a token the client already had, it fetches a new one and repeats the call once
  • Relations, articles and sales orders - and get(), post(), put(), delete() and head() for every other endpoint
  • Failures with a status - a SnelstartException with the HTTP status in $e->status(), and a timeout of 30 seconds
  • Safe with your keys - never in a URL, and replaced by [redacted] in error messages, log lines and command output
  • A connection test - php artisan snelstart:test
  • A standalone client - the same methods on cURL, for a project without Laravel
  • Laravel Boost - guideline and skill included, so an AI assistant in your app knows the API

Requirements

  • PHP 8.2+
  • Laravel 11, 12 or 13
  • A SnelStart client key and a subscription key for the B2B API, both issued by SnelStart
  • The cURL extension, only for the standalone client

Installation

composer require darvis/snelstart
SNELSTART_CLIENT_KEY=your-client-key
SNELSTART_SUBSCRIPTION_KEY=your-subscription-key
php artisan snelstart:test

The command prints ✓ Connection successful! and the company info of your administration, or ✗ Connection failed: with the reason.

Quick start

use Darvis\Snelstart\Exceptions\SnelstartException;
use Darvis\Snelstart\Services\SnelstartAPI;
use Illuminate\Http\Client\ConnectionException;

try {
    $snelstart = app(SnelstartAPI::class);

    $relations = $snelstart->getRelaties();
    $relation = $snelstart->createRelatie(['naam' => 'Example B.V.']);
    $other = $snelstart->get('/relaties/'.$id);   // any other endpoint
} catch (ConnectionException $e) {
    // SnelStart could not be reached, or did not answer within the timeout.
} catch (SnelstartException $e) {
    $status = $e->status();   // 401, 404, 429 ..., or 0 when there was no response
}

The arrays you pass go to SnelStart unchanged, and the decoded response comes back unchanged. A 429 or a 5xx is not retried.

Documentation

The full documentation lives on the documentation site:

Laravel Boost

This package ships a guideline and a skill for Laravel Boost. Run php artisan boost:install, or php artisan boost:update --discover in a project that already uses Boost.

Testing

composer test      # Pest
composer lint      # Pint, check only; composer format fixes
composer analyse   # Larastan

Changelog

See CHANGELOG.

Contributing

See CONTRIBUTING.

Security

Please report a vulnerability privately, as described in SECURITY, not in the issue tracker.

License

The MIT License (MIT). See LICENSE.