silarhi / caf-parser
A PHP parser for CAF LA44ZZ payment slips
Requires
- php: >=8.2
Requires (Dev)
- ergebnis/composer-normalize: ^2.54.0
- friendsofphp/php-cs-fixer: ^3.95.27
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.3.1
- phpstan/phpstan-strict-rules: ^2.1.0
- phpunit/phpunit: ^11.5.57 || ^12.5.38 || ^13.4.1
- rector/rector: ^2.7.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
CAF Parser
A PHP parser for CAF LA44ZZ payment slips.
Turn the plain-text "bordereau de paiement" sent by the Caisse d'Allocations Familiales into typed PHP objects.
📖 Documentation
Features
- LA44ZZ payment slips: every payment line of the table (beneficiary, period, gross, deduction and net amounts)
- Slip metadata: processing and payment dates, CAF name and address, recipient name and address, reference, BIC, IBAN and total
- Typed results: dates as
DateTimeInterface, amounts asfloat, French and English formats such as1 298,50or1,298.50 - Strict validation: malformed rows, malformed amounts and invalid or out-of-range dates throw a
ParseException - No dependencies: plain PHP, Windows (
\r\n) and Unix line endings
Requirements
- PHP 8.2+
Installation
composer require silarhi/caf-parser
Quick start
use Silarhi\Caf\Parser\PaymentSlipParser; $paymentSlip = (new PaymentSlipParser())->parse(file_get_contents('/path/to/LA44ZZ.txt')); $paymentSlip->getPaymentDate(); // DateTimeInterface $paymentSlip->getTotalAmount(); // e.g. 600.0 foreach ($paymentSlip->getLines() as $line) { $line->getBeneficiaryName(); // e.g. "MME EXEMPLE ALICE" $line->getNetAmount(); // e.g. 312.0 }
parse() throws a ParseException when the content is not a LA44ZZ payment slip, or a row, an amount or a date is invalid.
Documentation
Everything else is on caf-parser.silarhi.dev:
- Installation and quick start
- LA44ZZ files: what a slip holds and which parts are read
- Parsing: the table, dates, amounts and metadata
- Error handling: when
parse()throws, and its messages - Reference:
PaymentSlipParser, parsed objects (PaymentSlip,PaymentSlipLine), exceptions
Contributing
See CONTRIBUTING.md. Release notes are in CHANGELOG.md.
License
Released under the MIT License.
Built with care by SILARHI.
If CAF Parser saves you time, consider giving it a star on GitHub.