Docs
iamfredric/fortnox
Introduction
This package is a wrapper for the Fortnox API.
Requirements
- PHP ^8.1 or ^8.0
- Fortnox developer account
Installation
Install via composer
composer require iamfredric/fortnox
Configuration
\Iamfredric\Fortnox\Fortnox::setClientCredentials(
clientId: 'your-app-client-id',
clientSecret: 'your-app-client-secret',
redirectUrl: 'http://your-app-url/fortnox/callback',
scope: 'your scopes separated by spaces'
);
Authentication
// Redirect user to Fortnox for authentication
$url = \Iamfredric\Fortnox\Fortnox::authUrl();
// In your response handler, when fortnox redirects user back to your app,
$response = \Iamfredric\Fortnox\Fortnox::verifyAuthCode($_GET['code']);
$response['access_token'];
$response['refresh_token'];
$response['scope'];
$response['expires_in'];
$response['token_type'];
Changelog
License
This package is open-sourced software licensed under the MIT license.