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.

0.1.0(2mo ago)47941MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Jan 1Pushed 1mo ago2 watchersCompare

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

READMEChangelog (1)Dependencies (15)Versions (8)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

45

—

FairBetter than 91% of packages

Maintenance90

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

70d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8409819?v=4)[Bernskiold](/maintainers/bernskiold)[@bernskiold](https://github.com/bernskiold)

---

Top Contributors

[![ErikBernskiold](https://avatars.githubusercontent.com/u/1166728?v=4)](https://github.com/ErikBernskiold "ErikBernskiold (34 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (12 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-packagelaravelbernskioldmedialaravel-fortnox

###  Code Quality

TestsPest

### 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

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M101](/packages/dedoc-scramble)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M167](/packages/spatie-laravel-health)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.9k3](/packages/defstudio-telegraph)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)

PHPackages © 2026

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