Skip to content

Quick start

use Silarhi\Qif\Parser;
$parser = Parser::parseFile('/path/to/export.qif');
foreach ($parser->getTransactions() as $transaction) {
$transaction->getType(); // ?Types enum, e.g. Types::Bank
$transaction->getDate(); // ?DateTimeImmutable
$transaction->getAmount(); // ?float, e.g. -1234.5
$transaction->getDescription(); // ?string, the payee (P line)
$transaction->getStatus(); // Status enum
}

To parse content you already have in memory, use the constructor and call parse(), which returns the transactions:

$transactions = (new Parser($content))->parse();

Dates are read day first (25/12/2023) and the decimal separator of each amount is detected. For the month-first dates of US Quicken exports, or to read every amount with the same separator, pass the options:

use Silarhi\Qif\Enums\DateFormat;
use Silarhi\Qif\Enums\DecimalSeparator;
$parser = Parser::parseFile('/path/to/export.qif', DateFormat::MonthFirst, DecimalSeparator::Point);

A date or an amount that cannot be read without guessing (31/02/2023, 1,234) throws a Silarhi\Qif\Exception\ParseException. Every getter, and what the parser reads or ignores, is in Parsing QIF files.

Build Transaction objects, add them to a Writer, then print it or save it:

writing.php
<?php
use Silarhi\Qif\Enums\Types;
use Silarhi\Qif\Transaction;
use Silarhi\Qif\Writer;
$writer = new Writer();
$writer->addTransaction(
(new Transaction(Types::Bank))
->setDate(new DateTimeImmutable('2026-01-15'))
->setDescription('Example Hardware Store')
->setAddress("1 Market Square\nSpringfield")
->setMemo('Drill and bits')
->setAmount(-118.99)
->setCategory('Home')
->addSplit('Home:Tools', -100)
->addSplit('Tax', -18.99, 'VAT')
->markAsCleared()
);
$writer->addTransaction(
(new Transaction(Types::Bank))
->setDate(new DateTimeImmutable('2026-01-31'))
->setDescription('Acme Corp')
->setAmount('2,400.00')
->setCategory('Income:Salary')
);
echo $writer;
Output
!Type:Bank
D15/01/2026
T-118.99
LHome
SHome:Tools
$-100
STax
$-18.99
EVAT
Cc
PExample Hardware Store
A1 Market Square
ASpringfield
MDrill and bits
^
!Type:Bank
D31/01/2026
T2400
LIncome:Salary
C
PAcme Corp
^
$writer->saveToFile('/path/to/export.qif'); // or write it to disk

The fields the writer outputs, and their format, are in Writing QIF files.