PHP code example of stephenharris / phpqif
1. Go to this page and download the library: Download stephenharris/phpqif library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stephenharris / phpqif example snippets
// Instatiate the QIF Writer
$qif = new StephenHarris\QIF\Writer();
// Create a new transaction
$transaction = new Transaction( Transaction::CASH );
$transaction->setDate( new \DateTime( '2017-12-31' ) )
->setDescription( 'invoice-123: Some Payment' )
->setAmount( 68.99 )
->setCategory( 'Sales' )
->addSplit( 'Sales', 60 )
->addSplit( 'Fee', -3.01 )
->addSplit( 'Tax', 12 )
->markReconciled();
// Add it to the QIF
$qif->addTransaction( $transaction );
echo $qif;
// Instatiate the QIF Writer
$qifParser = new StephenHarris\QIF\Parser( $filePath );
$qifParser->parse();
foreach( $qifParser->getTransactions() as $transaction )
{
// your code
}