2017 © Pedro Peláez
 

library sepa-utilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

image

abcaeffchen/sepa-utilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  • Wednesday, February 21, 2018
  • by AbcAeffchen
  • Repository
  • 5 Watchers
  • 14 Stars
  • 61,665 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 18 Versions
  • 13 % Grown

The README.md

SepaUtilities

Unit Tests Latest Stable Version Total Downloads License Gitter, (*1)

General

SepaUtilities is a PHP class to check and sanitize inputs used in SEPA files such as IBAN numbers, creditor identifiers, names and other text., (*2)

PHP Versions

SepaUtilities supports PHP >= 8.1., (*3)

Installation

Composer

You can get SepaUtilities via Composer. Just add, (*4)

{
    "require": {
        "abcaeffchen/sepa-utilities": "^2.0"
    }
}

to your composer.json., (*5)

Direct download

If you don't use Composer, you can download SepaUtilities.php and just include it into your PHP files. Make sure you use the namespace AbcAeffchen\SepaUtilities\., (*6)

The Utilities

Have a look at the documentation., (*7)

Checks

  • checkIBAN($iban): Checks if the IBAN is valid by checking the format and by calculating the checksum and also removes whitespaces and changes all letters to upper case.
  • checkBIC($bic): Checks if the BIC is valid by checking the format and also removes whitespaces and changes all letters to upper case.
  • crossCheckIbanBic($iban, $bic): Checks if IBAN and BIC belong to the same country.
  • isNationalTransaction($iban1,$iban2): Checks if both IBANs are belong to the same country.
  • checkCharset($str): Checks if the string contains only allowed characters.
  • check($field, $input, $options, $version): Checks if the input fits the field. This function also does little format changes, e.g. correcting letter case. Possible field values are (case-insensitive):
    • initgpty: Initiating Party
    • initgptyid: Initiating Party ID
    • msgid: Message ID
    • pmtid: Payment ID
    • pmtinfid: Payment Information ID
    • cdtr: Creditor Name
    • ultmtcdrt: Ultimate Creditor
    • dbtr: Debtor Name
    • ultmtdebtr: Ultimate Debtor
    • ultmtdbtrid: Ultimate Debtor ID
    • iban: IBAN
    • bic: BIC
    • ccy: Currency
    • btchbookg: Batch Booking (boolean as string)
    • instdamt: Instructed Amount
    • rmtinf: Remittance Information
    • ci: Creditor Identifier
    • seqtp: Sequence Type
    • lclinstrm: Local Instrument
    • ctry: Two-letter country code, used in postal address
    • Subfield of pstlAdr
    • adrline: An address line, or an array of at most two address lines
    • bldgnm: Building name
    • bldgnb: Building number
    • twnnm: Town name
    • twnlctnnm: Town location name (within a town)
    • dstrctnm: District name
    • ctrysubdvsn: country subdivision, e.g. state, region, county
    • pstbx: Postbox
    • pstcd: Postal code
    • dept: Department
    • subdept: Subdepartment
    • strtnm: Street name
    • flr: Floor
    • room: Room

The $options take an array, (*8)

Sanitizing

  • sanitizeLength($input, $maxLen): Shortens the string if it is to long.
  • sanitizeShortText($input,$allowEmpty, $flags): Sanitizes the the charset and shortens the text if necessary.
  • sanitizeLongText($input,$allowEmpty, $flags): Sanitizes the the charset and shortens the text if necessary.
  • replaceSpecialChars($str): replaces all characters that are not allowed in sepa files by a allowed one or removes them. Take a look at this .xls file for more information Notice: Cyrillic is not supported yet, but greek letters are.
  • sanitize($field, $input, $flags): tries to sanitize the input, so it fits the field. Possible fields are
    • cdtr
    • dbtr
    • rmtinf
    • ultmtcdrt
    • ultmtdebtr
    • adrline

Wrappers

  • checkAndSanitize($field, $input, $flags, $options): Checks the input and if it is not valid it tries to sanitize it.
  • checkAndSanitizeAll(&$inputs, $flags, $options): Takes an array of inputs (field => value) and checks and sanitizes each of the fields. The input array is handed over as reference, so the result will be direct effect the input array. The return value is true, if everything is ok and else a string with problematic fields.

Date functions

  • getDate($date, $inputFormat): Returns $date in a SEPA-valid format. You can specify the input format by using the table on this site. By default the german date format (DD.MM.YYYY) is used.
  • getDateWithOffset($workdayOffset, $today, $inputFormat): Computes the next TARGET2 day (including today) with respect to an offset.
  • getDateWithMinOffsetFromToday($target, $workdayMinOffset, $inputFormat, $today): Returns the target date, if it has at least the given offset of TARGET2 days form today. Else the earliest date that respects the offset is returned.

Patterns

  • HTML_PATTERN_IBAN
  • HTML_PATTERN_BIC
  • PATTERN_IBAN
  • PATTERN_BIC
  • PATTERN_CREDITOR_IDENTIFIER
  • PATTERN_SHORT_TEXT
  • PATTERN_LONG_TEXT
  • PATTERN_RESTRICTED_IDENTIFICATION_SEPA1
  • PATTERN_MANDATE_ID

The HTML_PATTERN_* constants can be used as HTML5 pattern attribute. It is user friendlier than the corresponding PATTERN_* as they allow lowercase characters and whitespaces. This is corrected by the check methods., (*9)

Licence

SepaUtilities is licensed under the LGPL v3.0 License., (*10)

The Versions

21/02 2018

dev-master

9999999-dev https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate hhvm sanitize sepa iban php7

21/02 2018

1.2.5

1.2.5.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate hhvm sanitize sepa iban php7

22/10 2017

1.2.4

1.2.4.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate hhvm sanitize sepa iban php7

21/11 2016

1.2.3

1.2.3.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate hhvm sanitize sepa iban php7

18/10 2016

1.2.2

1.2.2.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate hhvm sanitize sepa iban php7

18/10 2016

1.2.1

1.2.1.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate hhvm sanitize sepa iban php7

16/10 2016

1.2.0

1.2.0.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP >= 5.6 and HHVM.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate hhvm sanitize sepa iban php7

21/09 2015

1.1.2

1.1.2.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

11/02 2015

1.1.1

1.1.1.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

05/02 2015

1.1.0

1.1.0.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

18/12 2014

1.0.7

1.0.7.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

24/10 2014

1.0.6

1.0.6.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

20/10 2014

1.0.5

1.0.5.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

19/10 2014

1.0.4

1.0.4.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

19/10 2014

1.0.3

1.0.3.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

18/10 2014

1.0.2

1.0.2.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

18/10 2014

1.0.1

1.0.1.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban

17/10 2014

1.0.0

1.0.0.0 https://github.com/AbcAeffchen/SepaUtilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in sepa files.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Alexander Schickedanz (AbcAeffchen)

validate sanitize sepa iban