Skip to content

brocc-ab/se-bank-account-php

Repository files navigation

Swedish Bank Account for PHP

Build Status Latest Version License: MIT

This package easily validates and returns details about Swedish bank account numbers using PHP. The details and validation rules are based on the documentation provided by Bankgirot, which can be found here.

Installation

Installing the Swedish Bank Account for PHP can be done using Composer.

composer require brocc/se-bank-account

Usage

Usage is very straight forward, just create a new instance of Brocc\SeBankAccount\Account which takes a string or an integer as argument and returns the details about the given number such as clearing number, account number and the name of the bank (if valid).

<?php

require 'vendor/autoload.php';

use Brocc\SeBankAccount\Account;

// Instantiate using full account number incl. clearing number.
// Note: the number can be in any format, only digits are validated and used.
$account = new Account('3300-7505092556');

// Check if valid, returns true or false.
$account->isValid(); // true

// Returns the clearing number.
$account->clearing(); // 3300

// Returns the account number excl. clearing number, null if not valid.
$account->number(); // 7505092556

// Returns the name of the bank.
$account->bank(); // Nordea Personkonto

If an account is not valid $account->isValid() will return false and the other methods will return null.

Supported Banks

Following Swedish banks are currently supported:

  • Aion Bank SA
  • Avanza Bank
  • BNP Paribas SA
  • Bankgirot
  • BlueStep Finans
  • Citibank
  • DNB Bank
  • Danske Bank
  • Ekobanken
  • Erik Penser
  • Forex Bank (discontinued*)
  • Handelsbanken
  • IKANO Bank
  • Ica Banken
  • JAK Medlemsbank
  • Klarna Bank
  • Landshypotek
  • Lunar Bank A/S
  • Länsförsäkringar Bank
  • Lån & Spar Bank Sverige
  • Marginalen Bank
  • MedMera Bank (discontinued*)
  • Multitude Bank plc
  • Nordax Bank (NOBA Bank Group**)
  • Nordea
  • Nordea Personkonto
  • Nordea/Plusgirot
  • Nordnet Bank
  • Northmill Bank
  • Resurs Bank
  • Riksgälden
  • SBAB
  • SEB
  • Santander Consumer Bank
  • Skandiabanken
  • Sparbanken Syd
  • Svea Bank
  • Swedbank
  • Swedbank fd. Sparbanken Öresund
  • Ålandsbanken Sverige AB

* Bank is currently not available in Bankgirot's documentation, available in package for backwards compatibility.
** Package will return Nordax Bank, even though the company name has changed to NOBA Bank Group.

Contributing

If you find a bug or a bank that might not be supported, please submit an issue on Github directly under issues.

Any contributions are welcome!