Skip to content

Quick start

Give the content of the file to PaymentSlipParser::parse(). It returns a PaymentSlip:

use Silarhi\Caf\Parser\PaymentSlipParser;
$parser = new PaymentSlipParser();
$paymentSlip = $parser->parse(file_get_contents('/path/to/LA44ZZ.txt'));
foreach ($paymentSlip->getLines() as $line) {
$line->getBeneficiaryReference(); // e.g. "1234567 A"
$line->getBeneficiaryName(); // e.g. "MME EXEMPLE ALICE"
$line->getStartDate(); // DateTimeInterface, 1st of the month at midnight
$line->getEndDate(); // DateTimeInterface, 1st of the month at midnight
$line->getNetAmount(); // e.g. 312.0
}

Here is a sample slip, with made-up data, and what the parser returns for it:

$paymentSlip->getProcessingDate(); // DateTimeImmutable '2026-02-05 00:00:00'
$paymentSlip->getPaymentDate(); // DateTimeImmutable '2026-02-03 00:00:00'
$paymentSlip->getCafName(); // "CAISSE D'ALLOCATIONS FAMILIALES DE DOCVILLE"
$paymentSlip->getCafAddress(); // "1 RUE DE L EXEMPLE, 99999 DOCVILLE CEDEX"
$paymentSlip->getRecipientName(); // "SCI EXEMPLE"
$paymentSlip->getRecipientAddress(); // "10 RUE DES ESSAIS, 99999 DOCVILLE"
$paymentSlip->getReference(); // "0000000 0001"
$paymentSlip->getBic(); // "TESTFRPP"
$paymentSlip->getIban(); // "FR7600000000000000000000000"
$paymentSlip->getTotalAmount(); // 600.0
count($paymentSlip->getLines()); // 3
$line = $paymentSlip->getLines()[0];
$line->getReference(); // ""
$line->getBeneficiaryReference(); // "1234567 A"
$line->getBeneficiaryName(); // "MME EXEMPLE ALICE"
$line->getStartDate(); // DateTimeImmutable '2026-01-01 00:00:00'
$line->getEndDate(); // DateTimeImmutable '2026-01-01 00:00:00'
$line->getGrossAmount(); // 312.0
$line->getDeduction(); // 0.0
$line->getNetAmount(); // 312.0
$line = $paymentSlip->getLines()[1];
$line->getReference(); // "0000000000000"
$line->getBeneficiaryReference(); // "2345678 B"
$line->getBeneficiaryName(); // "MR EXEMPLE BRUNO"
$line->getStartDate(); // DateTimeImmutable '2025-12-01 00:00:00'
$line->getEndDate(); // DateTimeImmutable '2026-01-01 00:00:00'
$line->getGrossAmount(); // 225.5
$line->getDeduction(); // 25.5
$line->getNetAmount(); // 200.0
$line = $paymentSlip->getLines()[2];
$line->getReference(); // ""
$line->getBeneficiaryReference(); // "3456789 C"
$line->getBeneficiaryName(); // "MME EXEMPLE CHLOE"
$line->getStartDate(); // DateTimeImmutable '2026-01-01 00:00:00'
$line->getEndDate(); // DateTimeImmutable '2026-01-01 00:00:00'
$line->getGrossAmount(); // 88.0
$line->getDeduction(); // 0.0
$line->getNetAmount(); // 88.0

The metadata getters of PaymentSlip return null when the file does not hold the information; the lines always have every field. See parsed objects for each getter.

parse() throws a ParseException when the content is not a LA44ZZ payment slip, or when a row, an amount or a date is invalid: see error handling.