<commit_before>BANK MAILs Parser
====================

Library for processing bank confirmation emails.
Right now only support of *Tatrabanka* two emails formats.


Instalation
-----------

Install package via composer:

```
$ composer require tomaj/bank-mails-parser
```

Usage
-----

Basic usage in php:

```
use Tomaj\BankMailsParser\Parser\TatraBankaMailParser;

$tatraBankaMailParser = new TatraBankaMailParser();
$mailContent = $tatraBankaMailParser->parse('mail content');

echo $mailContent->getKs() . "\n";
echo $mailContent->getSs() . "\n";
echo $mailContent->getVs() . "\n";
echo $mailContent->getReceiverMessage() . "\n";
echo $mailContent->getCurrency() . "\n";
echo $mailContent->getTransactionDate() . "\n";
echo $mailContent->getAccountNumber() . "\n";
echo $mailContent->getAmount() . "\n";
echo $mailContent->getAccountNumber() . "\n";

```

Usage with imap mail downlaoder
-------------------------------

Example how to use with [imap mail downloader](https://github.com/tomaj/imap-mail-downloader):

```
use Tomaj\ImapMailDownloader\Downloader;
use Tomaj\ImapMailDownloader\MailCriteria;
use Tomaj\ImapMailDownloader\Email;
use Tomaj\BankMailsParser\Parser\TatraBankaMailParser;

$downloader = new Downloader('*imap host*', *port*, '*username*', '*password*');

$criteria = new MailCriteria();
$criteria->setFrom('<EMAIL>');
$downloader->fetch($criteria, function(Email $email) {
    
    $tatraBankaMailParser = new TatraBankaMailParser();
	$mailContent = $tatraBankaMailParser->parse($email->getBody());
	
	// process $mailContent data...
	
	return true;
});
```

*Note*: You have to include package *imap-email-downloader*: ```composer require tomaj/imap-mail-downloader```


TODO
----

Add parses for other banks confirmation emails.
Feel free to fork and create pull requests with other banks parsers.
<commit_msg>Added badges<commit_after>BANK MAILs Parser
====================

Library for processing bank confirmation emails.
Right now only support of *Tatrabanka* two emails formats.


[![Build Status](https://secure.travis-ci.org/tomaj/bank-mails-parser.png)](http://travis-ci.org/tomaj/bank-mails-parser)
[![Coverage Status](https://coveralls.io/repos/tomaj/bank-mails-parser/badge.png?branch=master)](https://coveralls.io/r/tomaj/bank-mails-parser?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/54cf3fe4de7924b7ed000621/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54cf3fe4de7924b7ed000621)

[![Latest Stable Version](https://poser.pugx.org/tomaj/bank-mails-parser/v/stable.svg)](https://packagist.org/packages/tomaj/bank-mails-parser)
[![Latest Unstable Version](https://poser.pugx.org/tomaj/bank-mails-parser/v/unstable.svg)](https://packagist.org/packages/tomaj/bank-mails-parser)
[![License](https://poser.pugx.org/tomaj/bank-mails-parser/license.svg)](https://packagist.org/packages/tomaj/bank-mails-parser)

Instalation
-----------

Install package via composer:

```
$ composer require tomaj/bank-mails-parser
```

Usage
-----

Basic usage in php:

```
use Tomaj\BankMailsParser\Parser\TatraBankaMailParser;

$tatraBankaMailParser = new TatraBankaMailParser();
$mailContent = $tatraBankaMailParser->parse('mail content');

echo $mailContent->getKs() . "\n";
echo $mailContent->getSs() . "\n";
echo $mailContent->getVs() . "\n";
echo $mailContent->getReceiverMessage() . "\n";
echo $mailContent->getCurrency() . "\n";
echo $mailContent->getTransactionDate() . "\n";
echo $mailContent->getAccountNumber() . "\n";
echo $mailContent->getAmount() . "\n";
echo $mailContent->getAccountNumber() . "\n";

```

Usage with imap mail downlaoder
-------------------------------

Example how to use with [imap mail downloader](https://github.com/tomaj/bank-mails-parser):

```
use Tomaj\ImapMailDownloader\Downloader;
use Tomaj\ImapMailDownloader\MailCriteria;
use Tomaj\ImapMailDownloader\Email;
use Tomaj\BankMailsParser\Parser\TatraBankaMailParser;

$downloader = new Downloader('*imap host*', *port*, '*username*', '*password*');

$criteria = new MailCriteria();
$criteria->setFrom('<EMAIL>');
$downloader->fetch($criteria, function(Email $email) {
    
    $tatraBankaMailParser = new TatraBankaMailParser();
	$mailContent = $tatraBankaMailParser->parse($email->getBody());
	
	// process $mailContent data...
	
	return true;
});
```

*Note*: You have to include package *imap-email-downloader*: ```composer require tomaj/bank-mails-parser```


TODO
----

Add parses for other banks confirmation emails.
Feel free to fork and create pull requests with other banks parsers.

{'fraction_non_alphanumeric': 0.1848518111964874, 'fraction_numerical': 0.006586169045005488, 'mean_word_length': 4.863577863577864, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 13, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1931325', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1470, 'n_words': 296}