Search by

drei-d / laravel-sepa-xml

drei-d

There is no license information available for the latest version (2.0.0) of this package.

Creates SEPA XML files

Package info

github.com/DREI-D/laravel-sepa-xml

pkg:composer/drei-d/laravel-sepa-xml

Statistics

Installs: 808

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2026-11-19 13:34 UTC

This package is auto-updated.

Last update: 2026-11-19 13:36:40 UTC


README

This project was made to create SEPA xml files in Laravel.

Dependencies

These dependencies are required:

  • Laravel 10 or higher
  • PHP 8.4 or higher

... and for some features, these are needed:

  • ext-dom
  • ext-iconv

Installation

This project is available via composer.
To install it, run:

composer install drei-d/laravel-sepa-xml

Configuration

This project comes with a predefined config.
In order to use this package, you need to customize it to your needs.

Publish the configuration by running:

php artisan vendor:publish --provider=DREID\\LaravelSepaXml\\Providers\\ServiceProvider

The configuration file should look like the following:

return [
    'from'   => 'FROM EXAMPLE',
    'iban'   => 'IBAN EXAMPLE',
    'bic'    => 'BIC EXAMPLE',
    'prefix' => 'PREFIX-EXAMPLE-',

    // group transactions as a single transfer
    'batch_booking' => false
];
  • Replace FROM EXAMPLE with your companies name. You should use caps lock and no special characters.
  • Replace IBAN EXAMPLE with the IBAN of the bank account you want to send money from. Do not include spaces.
  • Replace BIC EXAMPLE with the BIC of the bank account you want to send money from. Do not include spaces.
  • Replace PREFIX with a unique identifier for your project. This prefix is used to generate unique End-to-End-IDs for your transactions.
  • If you want to group your transactions as a single transfer, you can set batch_booking to true. If you are not familiar with batch booking, feel free to check out this post.

An example for our company would be:

return [
    'from'   => 'DREID-D DIREKTWERBUNG GMBH CO KG',
    'iban'   => 'DE02120300000000202051',
    'bic'    => 'BYLADEM1001',
    'prefix' => '3D-INTERN-',

    // group transactions as a single transfer
    'batch_booking' => false
];

Usage

Saving to a file

You can create a new SEPA file using the provided Sepa facade, like this:

use DREID\LaravelSepaXml\Facades\Sepa;

$creator = Sepa::create('T1-2026-')
    ->addTransaction(
        subject: 'Test-Subject for Transaction',
        amount: 49.95, // amount in EUR
        accountOwner: 'Max Mustermann',
        iban: 'DE02120300000000202051', // IBAN
        bic: 'BYLADEM1001', // BIC
    )
    ->save('text.xml');

Getting the XML content as a string

Instead of saving to a file, you can also get the generated XML content like this:

use DREID\LaravelSepaXml\Facades\Sepa;

$creator = Sepa::create('T1-2026-')
    ->addTransaction(
        // ..
    )
    ->getContent();

Sanitizing the inputs

If you are not sure, whether your data contains (mostly forbidden) special characters or not, you can turn on the built-in sanitizer like this:

use DREID\LaravelSepaXml\Facades\Sepa;

$creator = Sepa::create('T1-2026-')
    ->sanitized()
    ->addTransaction(
        // ..
    )
    ->getContent();

Minifying the output

By default, the output gets formatted. You can also minify the XML instead:

use DREID\LaravelSepaXml\Facades\Sepa;

$creator = Sepa::create('T1-2026-')
    ->minified()
    ->addTransaction(
        // ..
    )
    ->getContent();

Using a different configuration per created file

If you need to create transactions from multiple accounts, you can pass a configuration class to the Sepa facade as well:

use DREID\LaravelSepaXml\Facades\Sepa;
use DREID\LaravelSepaXml\DataTransferObjects\ConfigurationDto;

$creator = Sepa::create(
    transactionNumber: 'T1-2026-',
    configurationDto: new ConfigurationDto(
        from: 'MAX MUSTERMANN',
        iban: 'DE02120300000000202051',
        bic: 'BYLADEM1001',
        prefix: 'TEST-',
        batchBooking: true,
    )
);