PHPackages                             ialpro/bundesland - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ialpro/bundesland

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ialpro/bundesland
=================

Lookup German Bundesland (state) by ZIP (and optional city) via Zippopotam.us.

v1.0.1(10mo ago)036MITPHPPHP &gt;=8.2

Since Aug 29Pushed 10mo agoCompare

[ Source](https://github.com/ialaminpro/bundesland)[ Packagist](https://packagist.org/packages/ialpro/bundesland)[ RSS](/packages/ialpro-bundesland/feed)WikiDiscussions main Synced today

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

🇩🇪 Laravel Bundesland Lookup
============================

[](#-laravel-bundesland-lookup)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d055a2df727c9fec19ec6e5cc99edb18d59c40811ac5337397be9dd9a370cb06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69616c70726f2f62756e6465736c616e642e737667)](https://packagist.org/packages/ialpro/bundesland)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

A Laravel package to look up the **German Bundesland (federal state)** by **postal code (PLZ)**, optionally verifying the city, using the [Zippopotam.us](http://www.zippopotam.us) API.

It provides a **Facade**, **global helper**, and **optional API route** — with caching for efficiency.

---

🚀 Installation
--------------

[](#-installation)

Require the package via Composer:

```
composer require ialpro/bundesland
```

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish the config (optional):

```
php artisan vendor:publish --tag=bundesland-config
```

This will create `config/zippopotam.php`:

```
return [
    'base_url'         => env('ZIPPOPOTAM_BASE_URL', 'https://api.zippopotam.us'),
    'country'          => env('ZIPPOPOTAM_COUNTRY', 'de'),
    'timeout'          => (int) env('ZIPPOPOTAM_TIMEOUT', 5),
    'cache_ttl'        => (int) env('ZIPPOPOTAM_CACHE_TTL', 21600), // 6h
    'enable_api_route' => (bool) env('BUNDESLAND_ENABLE_API', false),
];
```

---

🧑‍💻 Usage
---------

[](#‍-usage)

### Using the Facade

[](#using-the-facade)

```
use Ialpro\Bundesland\Facades\ZipLookup;

// Get Bundesland directly
$state = ZipLookup::stateByZip('10115'); // "Berlin"

// Full lookup with city check
$res = ZipLookup::lookup('80331', 'München');
if ($res->ok) {
    echo $res->state; // "Bayern"
} else {
    echo $res->message; // e.g. "City does not match ZIP"
}
```

### Using the Helper

[](#using-the-helper)

```
$state = bundesland('20095');                // "Hamburg"
$stateWithCheck = bundesland('80331','München'); // "Bayern"
```

### In Blade

[](#in-blade)

```
ZIP 10115 → {{ bundesland('10115') }}
ZIP 80331 + München → {{ bundesland('80331', 'München') }}
```

---

🌐 Optional API Route
--------------------

[](#-optional-api-route)

Enable in `.env`:

```
BUNDESLAND_ENABLE_API=true

```

This activates:

```
GET /api/bundesland/{zip}

```

Example:

```
GET /api/bundesland/10115
{
  "zip": "10115",
  "state": "Berlin"
}
```

---

🧪 Testing
---------

[](#-testing)

You can test with [Orchestra Testbench](https://github.com/orchestral/testbench).

Example:

```
public function test_lookup_berlin()
{
    $state = \Ialpro\Bundesland\Facades\ZipLookup::stateByZip('10115');
    $this->assertEquals('Berlin', $state);
}
```

---

📜 License
---------

[](#-license)

MIT © Al Amin

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance54

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

308d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e80efbbbcd8cec4e530404a65f1e21a2cd41ecd35dd3ba75580c57ab0c5a586a?d=identicon)[ialamin.pro](/maintainers/ialamin.pro)

---

Tags

laravelzipgermanybundesland

### Embed Badge

![Health badge](/badges/ialpro-bundesland/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[toin0u/geocoder-laravel

Geocoder Service Provider for Laravel

7615.4M17](/packages/toin0u-geocoder-laravel)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.0k1](/packages/mike-bronner-laravel-model-caching)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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