Download the PHP package pionect/visma-sdk without Composer
On this page you can find all versions of the php package pionect/visma-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package visma-sdk
Visma PHP SDK
A Laravel package for the Visma API, built with Saloon and automatically generated from OpenAPI specifications.
Table of Contents
- Requirements
- Installation
- Configuration
- Usage
- Using Dependency Injection
- Testing
- Pagination
- Regenerating the SDK
- Credits
Requirements
- PHP 8.2 or higher
- Laravel 10.x or higher
Installation
Configuration
The package automatically registers itself via Laravel auto-discovery.
Publish the config file:
Add your API credentials to .env:
Usage
Using Dependency Injection
The SDK connector is automatically registered in Laravel's service container, making it easy to inject into your controllers, commands, and other classes:
In Console Commands:
Testing
When testing code that uses the Visma SDK, you can mock the connector and its responses using factories. The SDK includes factory classes for all DTOs that make it easy to generate test data.
Here's an example of testing the CustomerController from the example above:
Note: When testing code that uses pagination, mock the underlying collection request (e.g., CustomerGetAllRequest) as shown above. The paginator will automatically use your mocked responses for each page.
Factory Methods
Every DTO in the SDK has a corresponding factory class with the following methods:
For more information on mocking Saloon requests, see the Saloon Mocking Documentation.
Pagination
The SDK supports automatic pagination for collection endpoints that return multiple pages:
Advanced: Memory-efficient streaming for large datasets
For processing thousands of records without loading everything into memory:
How it works:
dtoCollection(): Eagerly fetches all pages and returns a Laravel Collection of DTOs (simple, good for most cases)items(): Returns an iterator that lazily fetches pages (memory-efficient for large datasets)- The paginator automatically handles different pagination types used by various Visma API endpoints
Regenerating the SDK
This SDK is generated from the Visma API OpenAPI specification. Download the OpenApi specification from https://api.finance.visma.net/API-index/index.html To regenerate:
Credits
- Built with Saloon
- Generated using Saloon SDK Generator
All versions of visma-sdk with dependencies
saloonphp/laravel-plugin Version ^4.0
saloonphp/pagination-plugin Version ^2.3
saloonphp/saloon Version ^4.0
spatie/laravel-data Version ^4.0