Giter VIP home page Giter VIP logo

bav's Introduction

Bav

A small library for validating german bank account numbers. It provides classes which can be easily integrated into existing projects and is build for PHP 5.3+.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License PHP Version

Installation

To install jschaedl/bav install Composer first, if you haven't already

curl -sS https://getcomposer.org/installer | php

Then just add the following to your composer.json file:

// composer.json
{
	"require": {
		"jschaedl/bav": "*"
    }
}

Then, you can install the new dependencies by running Composer’s update command from the directory where your composer.json file is located:

# install
$ php composer.phar install
# update
$ php composer.phar update jschaedl/bav

# or you can simply execute composer command if you set it to
# your PATH environment variable
$ composer install
$ composer update jschaedl/bav

You can see this library on Packagist.

Composer installs autoloader at ./vendor/autoload.php. If you use jschaedl/bav in your php script, add:

require_once 'vendor/autoload.php';

Or you can use git clone command:

# HTTP
$ git clone https://github.com/jschaedl/Bav.git
# SSH
$ git clone [email protected]:jschaedl/Bav.git

Usage example

use Bav\Backend\Parser\BankDataParser;
use Bav\Backend\BankDataResolver;
use Bav\Encoder\EncoderFactory;

$bankDataFile = 'blz_2013_12_09_txt.txt';

$encoder = EncoderFactory::create(Bav::DEFAULT_ENCODING);

$parser = new BankDataParser($bankDataFile);
$parser->setEncoder($encoder);       

$bav = new Bav();
$bav->setBankDataResolver(new BankDataResolver($parser));

$bank = $bav->getBank('20090500');
$agency = $bank->getMainAgency();
$this->assertEquals('netbank', $agency->getName());
$this->assertEquals('000000', $agency->getIbanRule());

$bank = $bav->getBank('58561250');
$this->assertEquals('58564788', $bank->getBankId());

$bank = $bav->getBank('20090500');
$this->assertTrue($bank->isValid('1359100'));

How to contribute

If you want to fix some bugs or want to enhance some functionality, please fork the master branch and create your own development branch. Then fix the bug you found or add your enhancements and make a pull request. Please commit your changes in tiny steps and add a detailed description on every commit.

Unit Testing

All pull requests must be accompanied by passing unit tests. This repository uses phpunit and Composer. You must run composer install to install this package's dependencies before the unit tests will run. You can run the test via:

phpunit -c tests/phpunit.xml tests/

License and authors

This project is free and under GPL (see gpl.txt). So do what ever you want. But it would be nice to leave a note about the authors.

The authors of the original project who gave the idea to this project are Björn Wilmsmann and Markus Malkusch.

Responsible for this project is Jan Schädlich.

Requirements

You may have:

  • PHP 5.3.0 or greater
  • mbstring or iconv

BAV works with unicode encoding. Your PHP must have support compiled in to either the mb_* or the iconv_* functions. If these functions are missing BAV works only with the ISO-8859-15 encoding.

Bitdeli Badge

bav's People

Contributors

bitdeli-chef avatar jschaedl avatar malkusch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

siedi dischinator

bav's Issues

LogicException when quering for Bank

I did the following:

$bav = Bav::DE();
$bank = $bav->getBank('38651390');

This triggers the following Exception:

Fatal error: Uncaught exception 'LogicException' with message 'Start and end should be defined for bankId=37050299 (exception=The contextCache object should exist!)' in vendor/jschaedl/bav/library/Bav/Backend/Parser/BankDataParser.php:95
Stack trace:
#0 vendor/jschaedl/bav/library/Bav/Backend/BankDataResolver.php(37): Bav\Backend\Parser\BankDataParser->resolveAgencies('37050299')
#1 vendor/jschaedl/bav/library/Bav/Backend/BankDataResolver.php(20): Bav\Backend\BankDataResolver->resolveBankData('38651390')
#2 vendor/jschaedl/bav/library/Bav/Bav.php(38): Bav\Backend\BankDataResolver->getBank('38651390')
#3 test.php(6): Bav\Bav->getBank('38651390')
...

Another bank code triggering this behavior is for example 38650000. I had a quick look at the BankDataParser and the data file, but I am not sure what triggers the behavior above.

Upgrading from old malkusch/bav?

Hi,
i'm using the old bav-0.26 from malkusch.
Is there any chance for a short "how to upgrade" to this more recent version?
Or maybe is there already something like that?

Thanks
kscholz

Semantic Versioning

Hi,

can you please use semantic versioning according to the rules of http://semver.org for future releases? (for example "1.0.0" instead of "v1.0")

That enables users to use this library a lot easier. Releases with minor and patch level changes can be used without excessive manual testing by just requiring ~1.0 in the composer.json, because they should be backward compatible.

Thanks
Gordon

getBIC schlägt fehl, wenn es eine Nachfolge-BLZ gibt

Ich möchte die BIC für etliche Bankleitzahlen ermitteln. Dies schlägt bei folgender BLZ fehl: 63020450

Lt. blz_2014_03_03_txt.txt gibt es für 63020450 eine Nachfolge-BLZ 63020086.

Sollte hier getBic die korrekte BIC ermitteln können? (so dass die BIC von dieser Nachfolge-BLZ herangezogen wird)

Aktuell tut es dies leider nicht.

use Bav\Bav;

$bav = Bav::DE();
$bank = $bav->getBank("63020450");
$bic = $bank->getMainAgency()->getBic();

Obiges führt aktuell zu folgender Fehlermeldung:

Fatal error: Uncaught exception 'Bav\Bank\Exception\UndefinedAttributeException' in
/kunden/108014_96450/rp-hosting/10343/12345/domain/helper/iban/vendor/jschaedl/bav/library/Bav/Bank/Agency.php:100 
Stack trace: #0 /kunden/108014_96450/rp-hosting/10343/12345/domain/test.php(13):
Bav\Bank\Agency->getBic() #1 {main} thrown in 
/kunden/108014_96450/rp-hosting/10343/12345/domain/helper/iban/vendor/jschaedl/bav/library/Bav/Bank/Agency.php 
on line 100

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.