PHPackages                             tor2r/laravel-bring-api - 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. tor2r/laravel-bring-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

tor2r/laravel-bring-api
=======================

Fetch adresses and postal codes from Bring (no) API

v1.0.1(1mo ago)170[2 PRs](https://github.com/Tor2r/laravel-bring-api/pulls)MITPHPPHP ^8.2CI passing

Since Feb 12Pushed 1mo agoCompare

[ Source](https://github.com/Tor2r/laravel-bring-api)[ Packagist](https://packagist.org/packages/tor2r/laravel-bring-api)[ Docs](https://github.com/tor2r/laravel-bring-api)[ GitHub Sponsors](https://github.com/Tor2r)[ RSS](/packages/tor2r-laravel-bring-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (16)Versions (5)Used By (0)

Laravel Bring API
=================

[](#laravel-bring-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e70cc8e882be00586721c47834a3cd262ca2d6be96689a0165e8b181bf2b7265/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f7232722f6c61726176656c2d6272696e672d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tor2r/laravel-bring-api)[![GitHub Tests Action Status](https://camo.githubusercontent.com/9caf58fcaccb522597331d6ec278f58a966a4e4d2b0d60514502c2b769718aa7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f7232722f6c61726176656c2d6272696e672d6170692f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/tor2r/laravel-bring-api/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/424698284532e89c34c2fee9113e0d22ffe78fb50d7bf6f58981062793449e49/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f7232722f6c61726176656c2d6272696e672d6170692f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/tor2r/laravel-bring-api/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/19fc7985f23602a38ab2cff7722eb5d57d202e66d9bd6e1bc7f57e7542d0aa6e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f7232722f6c61726176656c2d6272696e672d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tor2r/laravel-bring-api)

A Laravel package for interacting with the [Bring API](https://developer.bring.com/api/). Fetch postal code information and addresses for Norwegian locations.

Supports Laravel 11, 12 and 13.

Supported Countries

- NO - Norway (default)
- DK - Denmark
- SE - Sweden
- FI - Finland
- NL - Netherlands
- DE - Germany
- US - United States
- BE - Belgium
- FO - Faroe Islands
- GL - Greenland
- IS - Iceland
- SJ - Svalbard and Jan Mayen

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

[](#installation)

You can install the package via composer:

```
composer require tor2r/laravel-bring-api
```

You can publish the config file with:

```
php artisan vendor:publish --tag="bring-api-config"
```

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env` file:

```
BRING_API_UID=your-mybring-email@example.com
BRING_API_KEY=your-api-key
```

You can get your API credentials by registering at [Mybring](https://www.mybring.com/) and generating an API key in your account settings.

The published config file (`config/bring-api.php`) contains:

```
return [
    'uid' => env('BRING_API_UID'),
    'key' => env('BRING_API_KEY'),
    'base_url' => env('BRING_API_BASE_URL', 'https://api.bring.com/address'),
    'default_countrycode' => env('BRING_API_DEFAULT_COUNTRYCODE', 'no'),
];
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

#### Get city name for a postal code

[](#get-city-name-for-a-postal-code)

```
use Tor2r\BringApi\Facades\BringApi;

$city = BringApi::postalCodeGetCity('8445'); // Default $countryCode = 'no'
// Returns: "Melbu"
```

#### Get full postal code information

[](#get-full-postal-code-information)

```
use Tor2r\BringApi\Facades\BringApi;

$data = BringApi::postalCode('1555');
// Returns an array with postal code details:
// [
//     'postal_codes' => [
//         [
//             'city' => 'Son',
//             'postal_code' => '1555',
//             'postal_code_type' => 'STREET_ADDRESSES',
//             'municipality' => 'Vestby',
//             'municipalityId' => '3019',
//             'county' => 'Akershus',
//             'latitude' => '59.5237',
//             'longitude' => '10.6862',
//         ]
//     ]
// ]
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use Tor2r\BringApi\BringApi;

class MyController
{
    public function show(BringApi $bringApi, string $postalCode)
    {
        $city = $bringApi->postalCodeGetCity($postalCode);

        return response()->json(['city' => $city]);
    }
}
```

### Error Handling

[](#error-handling)

The package throws `Tor2r\BringApi\Exceptions\BringApiException` when something goes wrong. Norwegian postal codes must be exactly 4 digits.

```
use Tor2r\BringApi\Facades\BringApi;
use Tor2r\BringApi\Exceptions\BringApiException;

try {
    $city = BringApi::postalCodeGetCity('0000'); // Non-existent postal code
} catch (BringApiException $e) {
    // API error response
}
```

### Available Methods

[](#available-methods)

MethodDescriptionReturns`postalCode(string $postalCode, string $countryCode = 'no')`Get full postal code data from Bring API`array``postalCodeGetCity(string $postalCode, string $countryCode = 'no')`Get only the city name for a postal code`?string`### Response Fields

[](#response-fields)

The `postalCode()` method returns an array containing a `postal_codes` key with the following fields per entry:

FieldTypeDescription`postal_code`stringThe postal code`city`stringCity name`municipality`stringMunicipality name`municipalityId`stringMunicipality ID`county`stringCounty name`postal_code_type`stringOne of: `STREET_ADDRESSES`, `PO_BOX`, `COMBINED`, `SPECIAL_SERVICE``latitude`stringLatitude (WGS84)`longitude`stringLongitude (WGS84)Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

Credits
-------

[](#credits)

- [Tor L](https://github.com/Tor2r)

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance89

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~36 days

Total

2

Last Release

59d ago

### Community

Maintainers

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

---

Top Contributors

[![Tor2r](https://avatars.githubusercontent.com/u/34723140?v=4)](https://github.com/Tor2r "Tor2r (11 commits)")

---

Tags

laravelTor2rlaravel-bring-api

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/tor2r-laravel-bring-api/health.svg)

```
[![Health](https://phpackages.com/badges/tor2r-laravel-bring-api/health.svg)](https://phpackages.com/packages/tor2r-laravel-bring-api)
```

###  Alternatives

[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[pdphilip/cf-request

Cloudflare Laravel Request

2725.6k1](/packages/pdphilip-cf-request)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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