PHPackages                             hairacless/sepa-utilities - 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. hairacless/sepa-utilities

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

hairacless/sepa-utilities
=========================

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

1.2.5(8y ago)0930LGPL-3.0PHPPHP &gt;=5.6.0

Since Oct 17Pushed 6y agoCompare

[ Source](https://github.com/hairacless/SepaUtilities)[ Packagist](https://packagist.org/packages/hairacless/sepa-utilities)[ Docs](https://github.com/AbcAeffchen/SepaUtilities)[ RSS](/packages/hairacless-sepa-utilities/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (18)Used By (0)

SepaUtilities
=============

[](#sepautilities)

[![Build Status](https://camo.githubusercontent.com/455cbcb3ff3e433a1667eaa034a8f049bd5a7152fd224f48b537918074dc8f58/68747470733a2f2f7472617669732d63692e6f72672f416263416566666368656e2f536570615574696c69746965732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/AbcAeffchen/SepaUtilities)[![Latest Stable Version](https://camo.githubusercontent.com/b83d77c3b8793dbf779ddfe3aea47aa72acc6f65c22ae4b3a0bbf09922de6f9a/68747470733a2f2f706f7365722e707567782e6f72672f616263616566666368656e2f736570612d7574696c69746965732f762f737461626c652e737667)](https://packagist.org/packages/abcaeffchen/sepa-utilities)[![Total Downloads](https://camo.githubusercontent.com/4000064e6821fad4b008a3463f4d43d111226479652306e1d76a2eadd8cca17b/68747470733a2f2f706f7365722e707567782e6f72672f616263616566666368656e2f736570612d7574696c69746965732f646f776e6c6f6164732e737667)](https://packagist.org/packages/abcaeffchen/sepa-utilities)[![License](https://camo.githubusercontent.com/34653c89abdd9f2255d9772920a741606d9ad4bfceb1419f5f0a502ac42cffa8/68747470733a2f2f706f7365722e707567782e6f72672f616263616566666368656e2f736570612d7574696c69746965732f6c6963656e73652e737667)](https://packagist.org/packages/abcaeffchen/sepa-utilities)[![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/AbcAeffchen/SepaUtilities?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

General
-------

[](#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.

PHP Versions
------------

[](#php-versions)

SepaUtilities supports PHP &gt;= 5.6 including 7.0, 7.1, 7.2 and HHVM. It should also work with PHP &gt;=5.4, but since this versions are *very* old and do not get security updates any more you should not use them. It is also possible, that some future work on SepaUtilities will break the support of PHP &lt; 5.6 and I will not check if this is the case.

Installation
------------

[](#installation)

### Composer

[](#composer)

You can get SepaUtilities via Composer. Just add

```
{
    "require": {
        "abcaeffchen/sepa-utilities": "~1.2.4"
    }
}
```

to your composer.json.

### Direct download

[](#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\`.

The Utilities
-------------

[](#the-utilities)

Have a look at the [documentation](http://htmlpreview.github.io/?https://raw.githubusercontent.com/AbcAeffchen/SepaUtilities/master/docs/html/index.html).

### Checks

[](#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 formatting changes, e.g. correcting letter case. Possible field values are:
    - `initgpty`: Initiating Party
    - `msgid`: Message ID
    - `pmtid`: Payment ID
    - `pmtinfid`: Payment Information ID
    - `cdtr`: Creditor Name
    - `ultmtcdrt`: Ultimate Creditor
    - `dbtr`: Debtor Name
    - `ultmtdebtr`: Ultimate Debtor
    - `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

The `$options` take an array

### Sanitizing

[](#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](http://www.europeanpaymentscouncil.eu/index.cfm/knowledge-bank/epc-documents/sepa-requirements-for-an-extended-character-set-unicode-subset-best-practices/) 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`

### Wrappers

[](#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 =&gt; 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

[](#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](http://de1.php.net/manual/en/function.date.php). By default the german date format (DD.MM.YYYY) is used.
- `getDateWithOffset($workdayOffset, $today, $inputFormat)`: Computes the next [TARGET2](http://en.wikipedia.org/wiki/TARGET2#TARGET2_holidays)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

[](#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.

Licence
-------

[](#licence)

SepaUtilities is licensed under the LGPL v3.0 License.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% 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 ~76 days

Recently: every ~122 days

Total

17

Last Release

3003d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.2.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3370996925f8450cd933e6f34a5d2bee3c2cb3d15c1a7880d136b86ccc4f1b0e?d=identicon)[bytesystems](/maintainers/bytesystems)

---

Top Contributors

[![AbcAeffchen](https://avatars.githubusercontent.com/u/5396140?v=4)](https://github.com/AbcAeffchen "AbcAeffchen (78 commits)")[![das-heimchen](https://avatars.githubusercontent.com/u/54495454?v=4)](https://github.com/das-heimchen "das-heimchen (3 commits)")

---

Tags

hhvmvalidatesepaPHP7sanitizeIBAN

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hairacless-sepa-utilities/health.svg)

```
[![Health](https://phpackages.com/badges/hairacless-sepa-utilities/health.svg)](https://phpackages.com/packages/hairacless-sepa-utilities)
```

###  Alternatives

[webmozart/assert

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

7.6k894.0M1.2k](/packages/webmozart-assert)[abcaeffchen/sepa-utilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP &gt;= 8.1.

312.0M2](/packages/abcaeffchen-sepa-utilities)[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[ronanguilloux/isocodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers &amp; Zipcodes for many countries

8013.3M23](/packages/ronanguilloux-isocodes)[wixel/gump

A fast, extensible &amp; stand-alone PHP input validation class that allows you to validate any data.

1.2k1.3M30](/packages/wixel-gump)[jschaedl/iban-validation

A small library for validating International BankAccount Numbers (IBANs).

1022.8M16](/packages/jschaedl-iban-validation)

PHPackages © 2026

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