PHPackages                             bmdevel/bav - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. bmdevel/bav

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

bmdevel/bav
===========

BAV provides validation for German Bank Accounts (Konto)

1.3.6(2y ago)259.3k—9.4%2WTFPLPHPPHP &gt;=7.2

Since May 26Pushed 2y ago3 watchersCompare

[ Source](https://github.com/bmdevel/bav)[ Packagist](https://packagist.org/packages/bmdevel/bav)[ Docs](http://bav.malkusch.de/)[ RSS](/packages/bmdevel-bav/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (32)Used By (0)

About BAV
=========

[](#about-bav)

BAV (bank account validator) is a validation library for German bank accounts. Its based among other things on [https://www.bundesbank.de/Redaktion/DE/Downloads/Aufgaben/Unbarer\_Zahlungsverkehr/pruefzifferberechnungsmethoden.pdf?\_\_blob=publicationFile](https://www.bundesbank.de/Redaktion/DE/Downloads/Aufgaben/Unbarer_Zahlungsverkehr/pruefzifferberechnungsmethoden.pdf?__blob=publicationFile)

Installation
============

[](#installation)

Use [Composer](https://getcomposer.org/):

```
{
    "require": {
        "malkusch/bav": "^1"
    }
}
```

Configuration
=============

[](#configuration)

You can use BAV out of the box. BAV comes with a ready to play default configuration ([`DefaultConfiguration`](http://bav-php.github.io/bav/api/class-malkusch.bav.DefaultConfiguration.html)):

- `UTF-8` encoding (if supported)
- [`FileDataBackendContainer`](http://bav-php.github.io/bav/api/class-malkusch.bav.FileDataBackendContainer.html). I.e. it uses binary search on the file from the Bundesbank. Note that this data backend uses the directory `bav/data` for install and update operations. You have to make sure that this directory is writable.
- automatic installation. You don't have to call any installation script. The container will download the Bundesbank file upon the first execution.
- update plan which triggers an E\_USER\_NOTICE if the Bundesbank file is outdated.

You can define your own configuration by calling [`ConfigurationRegistry::setConfiguration()`](http://bav-php.github.io/bav/api/class-malkusch.bav.ConfigurationRegistry.html#_setConfiguration)or preferably creating the file `bav/configuration.php` which returns a [`Configuration`](http://bav-php.github.io/bav/api/class-malkusch.bav.Configuration.html) object:

```
namespace malkusch\bav;

$configuration = new DefaultConfiguration();

$pdo = new \PDO("mysql:host=localhost;dbname=test;charset=UTF8");
$configuration->setDataBackendContainer(new PDODataBackendContainer($pdo));

$configuration->setUpdatePlan(new AutomaticUpdatePlan());

return $configuration;
```

Update
======

[](#update)

The Bundesbank releases new files for March, June, September and December. BAV needs those new files. You have several possiblities to update bav:

Script
------

[](#script)

Call `bin/bav-update.php`.

Programmatically
----------------

[](#programmatically)

```
use malkusch\bav\BAV;

$bav = new BAV();
$bav->update();
```

Automatic
---------

[](#automatic)

Enable automatic updates with [`AutomaticUpdatePlan`](http://bav-php.github.io/bav/api/class-malkusch.bav.AutomaticUpdatePlan.html)in your `bav/configuration.php`:

```
namespace malkusch\bav;

$configuration = new DefaultConfiguration();
$configuration->setUpdatePlan(new AutomaticUpdatePlan());

return $configuration;
```

This automatic update plan will perform long running update operations as a shutdown hook. I.e. it won't bother users during normal operations.

Usage
=====

[](#usage)

You can use BAV with the api facade [`BAV`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html):

- [`BAV::isValidBank($bankID)`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html#_isValidBank): Returns true for existing bank ids.
- [`BAV::isValidBankAccount($bankID, $account)`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html#_isValidBankAccount): Returns true for existing accounts of an existing bank.
- [`BAV::isValidAccount($account)`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html#_isValidAccount): This method validates an account against the bank of the last `isValidBank()` call.
- [`BAV::getValidBankFilterCallback()`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html#_getValidBankFilterCallback): Returns a callback for filter bank validation.
- [`BAV::getValidAccountFilterCallback()`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html#_getValidAccountFilterCallback): Returns a callback for filter account validation. The account filter needs to be called after the bank filter.
- [`BAV::getMainAgency()`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html#_getMainAgency): Returns the main agency of a bank.
- [`BAV::getAgencies()`](http://bav-php.github.io/bav/api/class-malkusch.bav.BAV.html#_getAgencies): Returns further agencies. The main agency is not included in this list. This list can be empty.

An [`Agency`](http://bav-php.github.io/bav/api/class-malkusch.bav.Agency.html)object has the fields:

- [`Agency::getBIC()`](http://bav-php.github.io/bav/api/class-malkusch.bav.Agency.html#_getBIC)
- [`Agency::getPostcode()`](http://bav-php.github.io/bav/api/class-malkusch.bav.Agency.html#_getPostcode)
- [`Agency::getCity()`](http://bav-php.github.io/bav/api/class-malkusch.bav.Agency.html#_getCity)
- [`Agency::getName()`](http://bav-php.github.io/bav/api/class-malkusch.bav.Agency.html#_getName)
- [`Agency::getShortTerm()`](http://bav-php.github.io/bav/api/class-malkusch.bav.Agency.html#_getShortTerm)
- [`Agency::getPAN()`](http://bav-php.github.io/bav/api/class-malkusch.bav.Agency.html#_getPAN)

Example
-------

[](#example)

```
use malkusch\bav\BAV;

$bav = new BAV();
$bankID  = "10000000";
$account = "1234567890"

// check for a bank
var_dump(
    $bav->isValidBank($bankID)
);

// check for a bank account
var_dump(
    $bav->isValidBankAccount($bankID, $account)
);

// filter validation
var_dump(
    filter_var($bankID, FILTER_CALLBACK, $bav->getValidBankFilterCallback()),
    filter_var($account, FILTER_CALLBACK, $bav->getValidAccountFilterCallback())
);

// Get informations about a bank
$agency = $bav->getMainAgency($bankID);
echo "{$agency->getName()} {$agency->getCity()}\n";
```

See also `bav/docs/example.php`.

Optional Dependencies
=====================

[](#optional-dependencies)

You may have:

- **CURL**: If you provide `bav/data/banklist.txt` you don't need CURL.
- **mbstring**: BAV works with unicode encoding. Your PHP must have support compiled in the `mb_*` functions. If these functions are missing BAV works only with the ISO-8859-15 encoding.
- **PDO**: If you intend to use a DBS you need to use [`PDODataBackendContainer`](http://bav-php.github.io/bav/api/class-malkusch.bav.PDODataBackendContainer.html). `PDODataBackendContainer` needs a `PDO` support compiled in PHP.
- **doctrine/orm**: You can use [`DoctrineBackendContainer`](http://bav-php.github.io/bav/api/class-malkusch.bav.DoctrineBackendContainer.html)which uses doctrine as data backend.

License and authors
===================

[](#license-and-authors)

This project is free and under the WTFPL. So do what ever you want. But it would be nice to leave a note about the authors.

The author of the original project which gave the idea to this project is Björn Wilmsmann. Responsable for this project is Markus Malkusch .

Donations
---------

[](#donations)

If you like BAV and feel generous donate a few Bitcoins here: 1335STSwu9hST4vcMRppEPgENMHD2r1REK

[![Build Status](https://camo.githubusercontent.com/e4f5ed54f902e01cbaa655460bb9a0b939ec0f5c6faf927946c8631ce3909a3a/68747470733a2f2f7472617669732d63692e6f72672f626d646576656c2f6261762e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bmdevel/bav)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 95.4% 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 ~127 days

Recently: every ~89 days

Total

29

Last Release

810d ago

Major Versions

0.29 → 1.0.02014-06-25

0.29.1 → 1.0.32015-01-13

0.29.2 → 1.0.42015-03-19

PHP version history (3 changes)0.28PHP &gt;=5

1.1.0PHP &gt;=5.4

1.3.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b1ad41927bdf81b01afd37feb45c33e7bbc52a4b56fd2592710ef923040e192?d=identicon)[bmdevel](/maintainers/bmdevel)

---

Top Contributors

[![malkusch](https://avatars.githubusercontent.com/u/1623984?v=4)](https://github.com/malkusch "malkusch (288 commits)")[![bmdevel](https://avatars.githubusercontent.com/u/11927236?v=4)](https://github.com/bmdevel "bmdevel (10 commits)")[![mrcgrtz](https://avatars.githubusercontent.com/u/166190?v=4)](https://github.com/mrcgrtz "mrcgrtz (1 commits)")[![schmidex](https://avatars.githubusercontent.com/u/2202857?v=4)](https://github.com/schmidex "schmidex (1 commits)")[![tobiasbaehr](https://avatars.githubusercontent.com/u/105220?v=4)](https://github.com/tobiasbaehr "tobiasbaehr (1 commits)")[![VasuLief](https://avatars.githubusercontent.com/u/4518408?v=4)](https://github.com/VasuLief "VasuLief (1 commits)")

---

Tags

checkvalidationBankaccountbankaccountkonto

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bmdevel-bav/health.svg)

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k489.6M672](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k148.7M416](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

64736.9M186](/packages/opis-json-schema)

PHPackages © 2026

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