Download the PHP package tor2r/laravel-bring-api without Composer
On this page you can find all versions of the php package tor2r/laravel-bring-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tor2r/laravel-bring-api
More information about tor2r/laravel-bring-api
Files in tor2r/laravel-bring-api
Package laravel-bring-api
Short Description Fetch adresses and postal codes from Bring (no) API
License MIT
Homepage https://github.com/tor2r/laravel-bring-api
Informations about the package laravel-bring-api
Laravel Bring API
A Laravel package for interacting with the Bring 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
You can install the package via composer:
You can publish the config file with:
Configuration
Add the following environment variables to your .env file:
You can get your API credentials by registering at Mybring and generating an API key in your account settings.
The published config file (config/bring-api.php) contains:
Usage
Using the Facade
Get city name for a postal code
Get full postal code information
Using Dependency Injection
Error Handling
The package throws Tor2r\BringApi\Exceptions\BringApiException when something goes wrong. Norwegian postal codes must be exactly 4 digits.
Available Methods
| Method | Description | Returns |
|---|---|---|
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
The postalCode() method returns an array containing a postal_codes key with the following fields per entry:
| Field | Type | Description |
|---|---|---|
postal_code |
string | The postal code |
city |
string | City name |
municipality |
string | Municipality name |
municipalityId |
string | Municipality ID |
county |
string | County name |
postal_code_type |
string | One of: STREET_ADDRESSES, PO_BOX, COMBINED, SPECIAL_SERVICE |
latitude |
string | Latitude (WGS84) |
longitude |
string | Longitude (WGS84) |
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-bring-api with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0