ufozone/php-sepa
最新稳定版本:v2.1
Composer 安装命令:
composer require ufozone/php-sepa
包简介
PHP class to create German SEPA files (XML) for credit transfer and direct debit.
README 文档
README
PHP class to creating SEPA files (XML) for credit transfers and direct debits in accordance with version 3.9 of the specification for remote data transmission between customer and bank according to the DFÜ agreement for the German banking industry.
The versions of the standard followed are:
- pain.001.001.09_GBIC_5.xsd for credit transfers
- pain.008.001.08_GBIC_5.xsd for direct debits
Always verify the generated files at your bank before using them in production!
License: BSD 2-Clause License
Installing
The recommended way to install php-sepa is through Composer.
composer require ufozone/php-sepa
Example of using SEPA Credit Transfer
$validatorFactory = new \ufozone\phpsepa\Sepa\Validator\Factory(); $sepa = new \ufozone\phpsepa\Sepa\CreditTransfer($validatorFactory); $sepa->setInitiator('Max Mustermann'); // Einreicher //$sepa->setId($msgId); // Nachrichtenreferenz $payment = new \ufozone\phpsepa\Sepa\Payment($validatorFactory); $payment->setPriority('HIGH'); // Prioritaet NORM oder HIGH $payment->setAccountName('Max Mustermann'); // Auftraggaber $payment->setAccountIban('DE02370501980001802057'); // Auftraggaber IBAN $payment->setAccountBic('COLSDE33'); // Auftraggaber BIC //$payment->setAccountCurrency($currency); // Kontowaehrung //$payment->disableBatchBooking(); // deaktiviere Sammelbuchung //$payment->setDate($date); // Faelligkeitsdatum $transactionPostalAddress = new \ufozone\phpsepa\Sepa\PostalAddress($validatorFactory); $transactionPostalAddress->setStreetName('Musterstraße 12a') ->setPostBox('12345') ->setTownName('Musterstadt') ->setPostCode('12345') ->setCountry('DE'); $transaction = new \ufozone\phpsepa\Sepa\Transaction($validatorFactory); $transaction->setEndToEndId('R2017742-1') // Transaktions-ID (End-to-End) ->setName('Karl Kümmel') // Name des Zahlungspflichtigen ->setPostalAddress($transactionPostalAddress) // Adresse des Zahlungspflichtigen ->setIban('DE02300209000106531065') // IBAN des Zahlungspflichtigen ->setBic('CMCIDEDD') // BIC des Zahlungspflichtigen ->setAmount(123.45) // abzubuchender Betrag ->setPurpose('SALA') // (optional) Zahlungstyp ->setReference('Rechnung R2017742 vom 17.06.2017'); // Verwendungszweck (eine Zeile, max. 140 Zeichen)) $payment->addTransaction($transaction); $transaction = new \ufozone\phpsepa\Sepa\Transaction($validatorFactory); $transaction->setEndToEndId('R2017742-1') ->setName('Doris Dose') ->setIban('DE02500105170137075030') ->setAmount(234.56) ->setPurpose('SALA') ->setReference('Kinderfahrrad'); $payment->addTransaction($transaction); $sepa->addPayment($payment); $xml = new \ufozone\phpsepa\Sepa\Xml($sepa); $xml->download('sepa.xml');
Example of using SEPA Direct Debit
$validatorFactory = new \ufozone\phpsepa\Sepa\Validator\Factory(); $sepa = new \ufozone\phpsepa\Sepa\DirectDebit($validatorFactory); $sepa->setInitiator('Max Mustermann'); // Einreicher //$sepa->setId($msgId); // Nachrichtenreferenz $payment = new \ufozone\phpsepa\Sepa\Payment($validatorFactory); //$payment->setScope('CORE'); // Lastschriftart (CORE oder B2B) $payment->setAccountName('Max Mustermann'); // Auftraggaber $payment->setAccountIban('DE02370501980001802057'); // Auftraggaber IBAN $payment->setAccountBic('COLSDE33'); // Auftraggaber BIC //$payment->setAccountCurrency($currency); // Kontowaehrung $payment->setCreditorId('DE98ZZZ09999999999'); // Glaeubigeridentifikationsnummer //$payment->disableBatchBooking(); // deaktiviere Sammelbuchung //$payment->setDate($date); // Gewuenschter Ausfuehrungstermin $transactionPostalAddress = new \ufozone\phpsepa\Sepa\PostalAddress($validatorFactory); $transactionPostalAddress->setStreetName('Musterstraße 12a') ->setPostBox('12345') ->setTownName('Musterstadt') ->setPostCode('12345') ->setCountry('DE'); $transaction = new \ufozone\phpsepa\Sepa\Transaction($validatorFactory); $transaction->setEndToEndId('R2017742-1') // Transaktions-ID (End-to-End) ->setName('Karl Kümmel') // Name des Zahlungspflichtigen ->setPostalAddress($transactionPostalAddress) // Adresse des Zahlungspflichtigen ->setIban('DE02300209000106531065') // IBAN des Zahlungspflichtigen ->setBic('CMCIDEDD') // BIC des Zahlungspflichtigen ->setAmount(123.45) // abzubuchender Betrag ->setPurpose('SALA') // (optional) Zahlungstyp ->setMandateId('M20170704-200') // Mandatsreferenz ->setMandateDate('2017-07-04') // Mandatsdatum ->setReference('Rechnung R2017742 vom 17.06.2017'); // Verwendungszweck (eine Zeile, max. 140 Zeichen)) $payment->addTransaction($transaction); $sepa->addPayment($payment); $xml = new \ufozone\phpsepa\Sepa\Xml($sepa); $xml->download('sepa.xml');
Running tests
vendor/bin/phpunit
External Resources
统计信息
- 总下载量: 3.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2025-07-17