drei-d / laravel-sepa-xml
There is no license information available for the latest version (1.2.1) of this package.
Creates SEPA XML files
1.2.1
2024-07-30 12:49 UTC
Requires
- php: ^8.2
- ext-dom: *
- ext-iconv: *
- laravel/framework: ^10|^11
README
This project was made to create SEPA xml files in Laravel.
Requirements
- Laravel 10 or higher
- PHP 8.2 or higher
- ext-dom & ext-iconv enabled
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
This project uses dependency injection. To get access to its services, you should inject them using the app() function, or, if possible, as function parameter.
Example:
use DREID\LaravelSepaXml\Factories\TransactionFactory; use DREID\LaravelSepaXml\Services\SepaFileCreationService; $factory = app(TransactionFactory::class); $service = app(SepaFileCreationService::class); $transaction = $factory->transform( 'Max Mustermann', // account owner 'Test-Subject for Transaction', // subject 'DE02120300000000202051', // IBAN 'BYLADEM1001', // BIC 49.95 // amount in EUR ); $service->save( 'local', // storage disk 'sepa.xml', // file name '1', // transaction number, should be unique per export [ $transaction ] // array of transactions you want to export );
When using the factory, your values are automatically sanitized. You can see the changes made by dumping the DTO.
dump($transaction);
The result should look like this:
[ 'accountOwner' => 'MAX MUSTERMANN', 'subject' => 'TEST-SUBJECT FOR TRANSACTION', 'iban' => 'DE02120300000000202051', 'bic' => 'BYLADEM1001', 'amount' => 49.95 ]