PHPackages                             bernskioldmedia/laravel-fortnox - 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. bernskioldmedia/laravel-fortnox

ActiveLibrary[API Development](/categories/api)

bernskioldmedia/laravel-fortnox
===============================

A Laravel package to consume the Fortnox API.

45021[4 PRs](https://github.com/bernskiold/laravel-fortnox/pulls)PHPCI passing

Since Oct 10Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/bernskiold/laravel-fortnox)[ Packagist](https://packagist.org/packages/bernskioldmedia/laravel-fortnox)[ RSS](/packages/bernskioldmedia-laravel-fortnox/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

Laravel Fortnox
===============

[](#laravel-fortnox)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a499e05fb753418eb06344348ac9ffc2ff57330c1f587607f3ee1cc9091f89e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265726e736b696f6c646d656469612f6c61726176656c2d666f72746e6f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bernskioldmedia/laravel-fortnox)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6362722f1b99a7c9179a734bd2c86b8bfcec56e62f2b002f27f2103a7a56a7e2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6265726e736b696f6c646d656469612f6c61726176656c2d666f72746e6f782f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/bernskioldmedia/laravel-fortnox/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/398a658c77608eef603cdbfce60746be8d642e2825169cdf5afe501512aa87b9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6265726e736b696f6c646d656469612f6c61726176656c2d666f72746e6f782f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/bernskioldmedia/laravel-fortnox/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e740a9682cd12fb517636b252bc98965a5e5ce9ebf27df2db1d6707771764c5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6265726e736b696f6c646d656469612f6c61726176656c2d666f72746e6f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bernskioldmedia/laravel-fortnox)

A Laravel package to consume the Fortnox API.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require bernskioldmedia/laravel-fortnox
```

Publishing the config file is optional. You can publish the config file with:

```
php artisan vendor:publish --provider="Bernskiold\LaravelFortnox\LaravelFortnoxServiceProvider" --tag="config"
```

You need to set your Fortnox app credentials in your `.env` file. You can obtain these credentials by creating an application in the Fortnox Developer Portal.

You also need to set which scopes you want to request access to. The scopes you can request are listed in the [Fortnox API documentation](https://www.fortnox.se/developer/guides-and-good-to-know/scopes).

```
FORTNOX_CLIENT_ID=your-client-id
FORTNOX_CLIENT_SECRET=your-client-secret
FORTNOX_SCOPES=scope1,scope2,scope3
```

Finally, you should register the command that refreshes access tokens automatically.

In Laravel 12 and later, you register the command in your `routes/console.php` file:

```
use Bernskiold\LaravelFortnox\Commands\RefreshAccessToken;
use Illuminate\Support\Facades\Schedule;

// Refresh the Fortnox access token if expired.
Schedule::call(RefreshAccessToken::class)->everyMinute()->withoutOverlapping();
```

In Laravel 11 and earlier, you can register the command in your `app/Console/Kernel.php` file:

```
use Bernskiold\LaravelFortnox\Commands\RefreshAccessToken;

protected function schedule(Schedule $schedule)
{
    // Refresh the Fortnox access token if expired.
    $schedule->call(RefreshAccessToken::class)->everyMinute()->withoutOverlapping();
}
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

You can use the provided `Fortnox` facade to access the support endpoints. For example, to get a list of invoices:

```
use Bernskiold\LaravelFortnox\Facades\Fortnox;

// This will return a collection of invoices.
$invoices = Fortnox::invoices()->all()->get();
```

### Changing the token storage

[](#changing-the-token-storage)

By default the package will store the access token in the Laravel cache. However, you can change this storage provider, either to one of the built-in providers or to a custom one.

To create a custom token storage provider, you need to implement the `Bernskiold\LaravelFortnox\Contracts\TokenStorage`interface. You can then register your custom provider in the `fortnox.php` config file under the `storage_provider` key.

The build-in storage providers are:

- `Bernskiold\LaravelFortnox\StorageProviders\CacheTokenStorage`: Uses Laravel's cache to store the token.
- `Bernskiold\LaravelFortnox\StorageProviders\LaravelSettingsStorage`: Uses Spatie's Laravel Settings package to store the token.

Both of these providers offer configuration settings in the `fortnox.php` config file.

### Acting as user or application

[](#acting-as-user-or-application)

The package supports both accessing the API as a Fortnox user or as a system application (via a service account). By default the package will act as a service account, but you may change this by changing the `use_service_account`option in the config file to `false`.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Bernskiold Media](https://github.com/bernskioldmedia)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance52

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 70.5% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/51986177e3badf5ae6cd008a309befe4ec88264bd518c1a623bd33f5cebc0fc5?d=identicon)[bernskiold](/maintainers/bernskiold)

---

Top Contributors

[![ErikBernskiold](https://avatars.githubusercontent.com/u/1166728?v=4)](https://github.com/ErikBernskiold "ErikBernskiold (31 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

fortnoxlaravellaravel-package

### Embed Badge

![Health badge](/badges/bernskioldmedia-laravel-fortnox/health.svg)

```
[![Health](https://phpackages.com/badges/bernskioldmedia-laravel-fortnox/health.svg)](https://phpackages.com/packages/bernskioldmedia-laravel-fortnox)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

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

PHP wrapper for the Meilisearch API

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

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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