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

ActiveLibrary[API Development](/categories/api)

bokbasen/php-api-client
=======================

Generic PHP API client for Bokbasen's API

v3.0.3(2y ago)022.9k↓50%21MITPHPPHP &gt;=7.1CI failing

Since Jun 26Pushed 2y ago8 watchersCompare

[ Source](https://github.com/Bokbasen/php-api-client)[ Packagist](https://packagist.org/packages/bokbasen/php-api-client)[ Docs](https://www.bokbasen.no)[ RSS](/packages/bokbasen-php-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (12)Versions (10)Used By (1)

php-api-client
==============

[](#php-api-client)

[![Build Status](https://camo.githubusercontent.com/9499b1c85391fa779f2d1e873b31a68aea8295b0a1c0288800774106b218f8cd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f426f6b626173656e2f7068702d6170692d636c69656e742f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Bokbasen/php-api-client/build-status/master) [![Code Coverage](https://camo.githubusercontent.com/d31e1128d25cbf4cea09e538d9efce43259b9e6ce5cebf4b79194a34a5d07015/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f426f6b626173656e2f7068702d6170692d636c69656e742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Bokbasen/php-api-client/?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/9f6a978d48867a9344305a3a28ad9d85f55f6e2f3449caf61a3d9617279ace39/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f426f6b626173656e2f7068702d6170692d636c69656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Bokbasen/php-api-client/?branch=master)

[Click here if you're looking for documentation to version 1.\*](https://github.com/Bokbasen/php-api-client/tree/v1.0.1)

Generic API client for use against all Bokbasen APIs where no spesific SDK is implemented that require authetication.

The HTTP client is simple in use and you must implement API spesific functionality yourself. But it provides a standard interface to do request against Bokbasen APIs and allow you to use the Login SDK handling any complexity related to authentication.

First create a Login object [see php-sdk-auth for details](https://github.com/Bokbasen/php-sdk-auth)

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

[](#installation)

We are using HttpClientDiscovery so you'll need to require a PSR-7 compatible implementation, e.g.;

```
$ composer require php-http/guzzle6-adapter

```

Then add our package:

```
$ composer require bokbasen/php-api-client

```

Usage
-----

[](#usage)

```
use Bokbasen\Auth\Login;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;

try {
    /* This example is using a file cache for the TGT, you can replace this with any PSR-6
        compatible cache. Always using caching in production to avoid performance penalty of
        creating and deleting tokens.
    */
    $cache = new FilesystemAdapter();
    $login = new Login('username', 'password', Login::URL_PROD, $cache);
} catch(\Throwable $e) {
    // error handling
}
```

```
use Bokbasen\ApiClient\Client;
use Bokbasen\ApiClient\HttpRequestOptions;
use Bokbasen\ApiClient\Exceptions\BokbasenApiClientException;

try {
    /* Pass the base URL of the API you are interacting with. You can also pass a logger
        and a custom http client. Any request made through the API returns an instance
        of \Psr\Http\Message\ResponseInterface.  All of these API calls will include the
        necessary authentication headers.
    */
    $client = new Client($login, 'https://loan.api.boknett.no');

    // Execute get request, it is recommended to explicitly set accept parameter
    $headers = ['Accept' => HttpRequestOptions::CONTENT_TYPE_JSON];
    $response = $client->get('/path', $headers);

    // Execute POST request with json data
    $response = $client->postJson('/path', $body, $headers);

    // Execute POST request
    $response = $client->post('/path', $body, $headers);

    // Execute PUT request
    $response = $client->put('/path', $body, $headers);

    // Execute PATCH request
    $response = $client->patch('/path', $body, $headers);
} catch(BokbasenApiClientException $e){
    //error handling
}
```

Tests
-----

[](#tests)

```
$ ./vendor/bin/phpunit

```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% 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 ~310 days

Recently: every ~489 days

Total

9

Last Release

769d ago

Major Versions

v1.0.1 → v2.0.02018-10-18

v2.0.2 → v3.0.02019-06-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/89978e62fc6488adfff83f28bfed9f976b7d2ed1e893ac2bfbd6324a34c2f430?d=identicon)[bokbasen](/maintainers/bokbasen)

---

Top Contributors

[![htollefsen](https://avatars.githubusercontent.com/u/3762720?v=4)](https://github.com/htollefsen "htollefsen (4 commits)")[![adamsokolowski06](https://avatars.githubusercontent.com/u/37297805?v=4)](https://github.com/adamsokolowski06 "adamsokolowski06 (1 commits)")[![kjank8](https://avatars.githubusercontent.com/u/72562086?v=4)](https://github.com/kjank8 "kjank8 (1 commits)")[![stadskle](https://avatars.githubusercontent.com/u/6637162?v=4)](https://github.com/stadskle "stadskle (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[florianv/exchanger

Currency exchange rates framework for PHP

1874.7M15](/packages/florianv-exchanger)[brd6/notion-sdk-php

Notion SDK for PHP

5918.0k](/packages/brd6-notion-sdk-php)[wordpress/php-ai-client

A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.

26236.6k14](/packages/wordpress-php-ai-client)[apigee/apigee-client-php

Client library for connecting to the Apigee Edge API.

27558.7k3](/packages/apigee-apigee-client-php)[dhope0000/lxd

PHP-based API wrapper for LXD REST API.

136.2k](/packages/dhope0000-lxd)

PHPackages © 2026

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