PHPackages                             audunru/fiken-api-php-client - 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. audunru/fiken-api-php-client

AbandonedArchivedLibrary[API Development](/categories/api)

audunru/fiken-api-php-client
============================

Connect to the Fiken API

v3.0.0(2y ago)81.0kMITPHPPHP ^8.2

Since Jan 24Pushed 2y agoCompare

[ Source](https://github.com/audunru/fiken-api-php-client)[ Packagist](https://packagist.org/packages/audunru/fiken-api-php-client)[ RSS](/packages/audunru-fiken-api-php-client/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (9)Versions (17)Used By (0)

Fiken API PHP Client
====================

[](#fiken-api-php-client)

[![Coverage Status](https://camo.githubusercontent.com/75a0c6de6e09337b563b8e744a9f7cb791bcd7209a90044d43158319e8f5af75/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f617564756e72752f66696b656e2d6170692d7068702d636c69656e742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/audunru/fiken-api-php-client?branch=master)[![StyleCI](https://camo.githubusercontent.com/9181c68534e2628b00c3a3a4f9ec5bc5283a5ca50d34c806491c7ccc874399ab/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3138393634333134392f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/189643149)

2024 update: [Fiken has released a v2 of their API](https://api.fiken.no/api/v2/docs/). Please use this API directly. This package only works with the now deprecated v1 API.

Fiken.no is an online accounting system aimed at making accounting easy for small businesses.

You can use this package to retrieve resources (companies, products, accounts, etc) from Fiken, or create new resources (eg. a customer or a product). You can also create invoices and cash sales.

You can use the Fiken API with demo accounts for free, otherwise there's a monthly fee per company.

[Fiken API official documentation](https://fiken.no/api/doc/)

I don't work for Fiken.

A word of warning
=================

[](#a-word-of-warning)

Please create a demo account in Fiken (it's free) and use that when integrating this package in your project, before you use it with a real Fiken account. The package performs almost no checks before connecting to the Fiken API, so you can very easily make a mistake and create erroneous data in Fiken.

Installation
============

[](#installation)

```
composer require audunru/fiken-api-php-client
```

Usage
=====

[](#usage)

Test authentication
-------------------

[](#test-authentication)

```
use audunru\FikenClient\FikenClient;

$client = new FikenClient();

// The Fiken API uses basic authentication
// According to their documentation, you should create a separate user for accessing the API
$client->authenticate('username', 'password');

// $user is a User object
$user = $client->user();

echo $user->name; // Art Vandelay
```

Companies
---------

[](#companies)

```
use audunru\FikenClient\FikenClient;

$client = new FikenClient();
$client->authenticate('username', 'password');

// $companies is a Collection, so you can use Laravel Collection methods to filter or get etc.
// See https://laravel.com/docs/5.8/collections
$companies = $client->companies();
$company = $companies->first();

echo $company->name; // Vandelay Industries
```

Bank accounts, products and other resources that belong to a company.
---------------------------------------------------------------------

[](#bank-accounts-products-and-other-resources-that-belong-to-a-company)

In order to get these resources, you need to get a company first.

```
use audunru\FikenClient\FikenClient;

$client = new FikenClient();
$client->authenticate('username', 'password');

// $company is a Company object
$company = $client->setCompany('123456789'); // 123456789 is the organization number

echo $company->name; // Vandelay Industries

// These are all collections, so the Laravel Collection methods can be used on them
$bankAccounts = $company->bankAccounts();
$products = $company->products();
$contacts = $company->contacts();
$accounts = $company->accounts(2019); // To get accounts, you need to set a year

// $product is a Product object
$product = $products->firstWhere('name', 'Latex');
```

Creating a customer:

```
use audunru\FikenClient\FikenClient;
use audunru\FikenClient\Models\Contact;

$client = new FikenClient();
$client->authenticate('username', 'password');

$company = $client->setCompany('123456789');

$customer = new Contact(['name' => 'Kel Varnsen', 'customer' => true]);

// $saved is a new FikenCustomer object
$saved = $company->add($customer);
```

Creating an invoice:

```
use audunru\FikenClient\FikenClient;
use audunru\FikenClient\Models\Invoice;
use audunru\FikenClient\Models\InvoiceLine;

$client = new FikenClient();
$client->authenticate('username', 'password');

$company = $client->setCompany('123456789');

// Create a new invoice object
$invoice = new Invoice(['issueDate' => '2019-01-01', 'dueDate' => '2019-01-15']);

// Find an existing customer of this company and set it on the invoice
$customer = $company->contacts()->firstWhere('name', 'Kel Varnsen');
$invoice->setCustomer($customer);

// Find a bank account and set it on the invoice
$bankAccount = $company->bankAccounts()->firstWhere('number', '12341234999');
$invoice->setBankAccount($bankAccount);

// Set invoice text
$invoice->invoiceText = 'Payment for import and export services';

// Find a product
$product = $company->products()->firstWhere('name', 'Chips');

// Create a new invoice line
$line = new InvoiceLine(['netAmount' => 8000, 'vatAmount' => 2000, 'grossAmount' => 10000]);
// Set product on the invoice line
$line->setProduct($product);

// Add the invoice line to the invoice
$invoice->add($line);

// Add the invoice to the company
$saved = $company->add($invoice);
// $saved is a new Invoice object
```

Development
===========

[](#development)

Testing
-------

[](#testing)

Copy .env file, then open it and set your variables:

```
cp .env.example .env.testing
```

Run tests:

```
composer test
```

The tests in the directory `tests\Feature` connect to the Fiken API. Before running these tests, you will have to set a username, password and organization number in the file `.env.testing`.

WARNING: Create a dummy account in Fiken and use that to run your tests, otherwise the tests will generate fake data in your Fiken account!

Tests that connect to the Fiken API have to be run with this command:

```
composer test -- --group dangerous

```

Run tests and generate coverage reports:

```
composer test-with-coverage
php vendor/bin/php-coveralls
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

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

Every ~128 days

Recently: every ~256 days

Total

13

Last Release

811d ago

Major Versions

v1.4.0 → v2.0.02023-07-18

v2.0.0 → v3.0.02024-04-07

PHP version history (4 changes)v1.0.0PHP ^7.3

v1.2.0PHP ^7.3|^8.0

v2.0.0PHP ^8.1

v3.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5163790?v=4)[Audun Rundberg](/maintainers/audunru)[@audunru](https://github.com/audunru)

---

Top Contributors

[![audunru](https://avatars.githubusercontent.com/u/5163790?v=4)](https://github.com/audunru "audunru (82 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

fiken

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/audunru-fiken-api-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/audunru-fiken-api-php-client/health.svg)](https://phpackages.com/packages/audunru-fiken-api-php-client)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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