PHPackages                             fakturan.nu/fakturan - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. fakturan.nu/fakturan

ActiveApi-client[HTTP &amp; Networking](/categories/http)

fakturan.nu/fakturan
====================

REST API client for Fakturan.nu

1.1.0(11y ago)248[1 issues](https://github.com/imagine-it/fakturan.nu-api-v2-client-php/issues)MITPHP

Since Apr 14Pushed 10y ago10 watchersCompare

[ Source](https://github.com/imagine-it/fakturan.nu-api-v2-client-php)[ Packagist](https://packagist.org/packages/fakturan.nu/fakturan)[ Docs](https://fakturan.nu/apidocs)[ RSS](/packages/fakturannu-fakturan/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

\#Fakturan.nu REST API client PHP API-client in PHP for the web based software of [Fakturan.nu](https://fakturan.nu). Documentation can be viewed at [API documentation](https://fakturan.nu/apidocs/).

\##Getting started

\###Requirements

- PHP 5.4+

\###Installation You can install the library via [Composer](http://getcomposer.org) by adding the following line to the require block of your composer.json file:

```
"fakturan.nu/fakturan": "1.1.*"
```

followed by running `composer install`.

\###Setup You authenticate by simply adding your encrypted `key_id` and `password` and then you're good to go! Remember to use sandbox-mode in development. When ready to use in production you can just remove the third parameter.

```
Fakturan\Fakturan::setup('KEY_ID', 'PASSWORD', [
  'sandbox' => TRUE
]);
```

\###Examples Retrieve all your products

```
Fakturan\Model\Product::all();
```

Create a new product

```
$new_product = new Fakturan\Product();
$new_product->name = 'My new shiny product';
$new_product->unit = 'KG';
$new_product->price = 450;

$new_product->save();
```

Get a single product with id 54

```
$book = Fakturan\Product::find(54);
```

Get a single product via search

```
$product = Fakturan\Product::findBy(['product_code' => 2]);
```

Edit product

```
$book = Fakturan\Product::find(54);
$book->price = 25;
$book->save();
```

Delete a product

```
$product_to_be_deleted = Fakturan\Product::find(54);
$product_to_be_deleted->destroy();
```

Create an invoice

```
// Find your client
$client = Fakturan\Client::find(1);

$invoice = new Fakturan\Invoice();
$invoice->client_id = $client->id;
$invoice->date = date('Y-m-d');

// Find a product to use for templating
$product = Fakturan\Product::find(24);

// Add the product to the invoice. The second parameter can override the default values.
// It is used to set the amount and makes it possible to add a discount.
// See https://fakturan.nu/apidocs/2/invoices/create.html for possible attributes on rows.
$invoice->addRow($product, ['amount' => 5]);

// It is also possible to add rows without a preset product by sending an array instead:
$row = [
	'product_name' => 'My custom product',
	'unit' => 'PCS',
	'price' => 500,
	'amount' => 24
];
$invoice->addRow($row)

// Rows only consisting of text can also be added
$invoice->addRow(['text_row' => true, 'text' => 'Performed customizations: purple flames']);

$invoice->save();
```

\###Errors The API will answer with different kinds of Exceptions depending on type of issue:

```
Fakturan\Error\AccessDenied       // Catches 401 (access denied)
Fakturan\Error\ResourceNotFound   // Catches 404 (Resource not found).
Fakturan\Error\ConnectionFailed   // Catches 407 (Connection to server failed).
Fakturan\Error\ResourceInvalid    // Catches 422 (Validation errors).
Fakturan\Error\ClientError        // Catches 400-499 (Client errors).
Fakturan\Error\ServerError        // Catches 500-599 (Server related issues).
Fakturan\Error\FakturanException  // Catches all of the above
```

As they all inherits from `Fakturan\Error\FakturanException` they can all be caught within one catch-block:

```
try {
	// Methods that sends a request to the server
}
catch(Fakturan\Error\FakturanException $e)
{
  echo $e->getMessage();
}
```

When in production we recommend you to always use a try-catch block when using `save`, `update_attributes` and `delete`

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 94.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 ~7 days

Total

5

Last Release

4020d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8e251c22a8b3be4966c9aff6c272ca7497ed35cabd37798a1f66103aa9ecbcd?d=identicon)[mintcore](/maintainers/mintcore)

---

Top Contributors

[![johantell](https://avatars.githubusercontent.com/u/1777129?v=4)](https://github.com/johantell "johantell (73 commits)")[![jontebol](https://avatars.githubusercontent.com/u/87823?v=4)](https://github.com/jontebol "jontebol (2 commits)")[![PtrLarsson](https://avatars.githubusercontent.com/u/3625585?v=4)](https://github.com/PtrLarsson "PtrLarsson (2 commits)")

---

Tags

apirestinvoiceinvoicingFakturan

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fakturannu-fakturan/health.svg)

```
[![Health](https://phpackages.com/badges/fakturannu-fakturan/health.svg)](https://phpackages.com/packages/fakturannu-fakturan)
```

###  Alternatives

[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)[angelleye/paypal-php-library

PHP wrapper for PayPal APIs

243440.9k](/packages/angelleye-paypal-php-library)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34170.2k2](/packages/onesignal-onesignal-php-api)[ory/hydra-client

Documentation for all of Ory Hydra's APIs.

17435.9k](/packages/ory-hydra-client)[zenditplatform/zendit-php-sdk

PHP client for Zendit API

1204.3k](/packages/zenditplatform-zendit-php-sdk)[whatarmy/fedex-rest

New FedEx Rest API wrapper

2440.5k1](/packages/whatarmy-fedex-rest)

PHPackages © 2026

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