Skip to content

Conversation

@tomaj
Copy link
Owner

@tomaj tomaj commented Aug 28, 2025

Summary

  • Add VubMailParser - Support for VUB bank emails (Slovakia)
  • Comprehensive README improvements - Professional documentation with examples
  • Proper project structure - VUB parser in correct src/Parsers/Vub/ directory

New VUB Parser Features

🏦 Bank Support

  • VUB (Všeobecná úverová banka) - Major Slovak banking institution
  • Handles plain text confirmation emails from nonstopbanking@vub.sk
  • Extracts transaction details using regex pattern matching

📊 Extracted Data

  • Transaction date - Parsed from "Dtum:" field
  • Amount - From "Suma:" with comma decimal separator handling
  • Source account - IBAN from "Z tu:" field
  • Variable Symbol (VS) - From "VS:" field
  • Constant Symbol (KS) - From "KS:" field
  • Unicode handling - Proper support for non-breaking spaces

🧪 Testing

  • Comprehensive test coverage with real email format examples
  • Validates all extracted fields against expected values
  • 40/40 tests passing including new VUB parser tests

Documentation Improvements

📚 Professional README Structure

  • Bank support matrix with country flags and feature comparison
  • Quick Start guide with immediate usage examples
  • Email format examples showing actual bank email structures
  • Complete MailContent API documentation with all getters
  • Error handling guide with validation patterns and common scenarios

🛡️ Security & Best Practices

  • PGP key management recommendations for encrypted emails
  • Data validation examples for production environments
  • Security considerations for handling sensitive banking data

🤝 Developer Experience

  • Contributing guidelines with step-by-step bank parser creation
  • Migration guides for all major version transitions
  • PHP compatibility matrix showing supported versions
  • Development setup instructions with required tools

Technical Implementation

🏗️ Architecture

namespace Tomaj\BankMailsParser\Parser\Vub;

class VubMailParser implements ParserInterface 
{
    public function parse(string $content): ?MailContent
}

📁 File Structure

src/Parsers/Vub/VubMailParser.php       # Main parser class
tests/Parsers/Vub/VubMailParserTest.php # Comprehensive tests

🔍 Code Quality

  • PHPStan level 5 - No static analysis errors
  • Strict typing - declare(strict_types=1) throughout
  • PSR standards - Follows existing project coding conventions
  • 100% backward compatibility - No breaking changes to existing APIs

Example Usage

use Tomaj\BankMailsParser\Parser\Vub\VubMailParser;

$parser = new VubMailParser();
$mailContent = $parser->parse($emailContent);

if ($mailContent) {
    echo "Amount: " . $mailContent->getAmount() . "\n";
    echo "VS: " . $mailContent->getVs() . "\n";  
    echo "Account: " . $mailContent->getAccountNumber() . "\n";
}

Testing Results

  • 40/40 tests passing (338 assertions)
  • PHPStan clean (0 errors at level 5)
  • All existing parsers continue to work unchanged
  • VUB parser handles real email format correctly

Impact

This PR expands the library's banking coverage to include VUB, one of Slovakia's largest banks, while significantly improving the developer experience through comprehensive documentation and examples.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

tomaj added 4 commits August 28, 2025 21:01
### Added VUB Parser
- Port VubMailParser from REMP2020 repository to proper directory structure
- Support for VUB bank email parsing (Slovakia) in src/Parsers/Vub/
- Extract transaction date, amount, account numbers, VS/KS symbols
- Comprehensive test coverage with real email format examples
- Follows existing project patterns and namespace conventions

### Documentation Improvements
- Professional bank support matrix with country flags and features
- Quick Start guide with immediate usage example after installation
- Complete MailContent API documentation with all available getters
- Email format examples showing real bank email structures
- Error handling guide with validation examples and common scenarios
- Security considerations including PGP key management best practices
- Contributing guidelines with step-by-step process for adding banks
- Structured migration guides covering all major version changes
- PHP/library compatibility matrix showing supported versions

### Technical Details
- VUB parser handles Slovak bank confirmation emails with regex patterns
- Extracts: transaction date, source account, amount, variable/constant symbols
- All existing functionality preserved with 100% backward compatibility
- 40/40 tests passing with comprehensive coverage
- PHPStan analysis clean at existing level 5 configuration
- No breaking changes to existing parser APIs or return types

The VUB parser complements existing TatraBanka and ČSOB parsers,
providing comprehensive coverage of major Slovak banking institutions.
- Fixed PSR2 compliance in VubMailParser.php
- Fixed PSR2 compliance in VubMailParserTest.php
- Applied via phpcbf automatic formatting
The Makefile is not referenced anywhere in the project:
- GitHub Actions CI uses direct vendor/bin commands
- README documentation uses composer scripts
- No build scripts reference make targets

Cleanup legacy file for cleaner project structure.
…sistency

- Moved src/Parsers/ to src/Parser/ to match namespace Tomaj\BankMailsParser\Parser- Moved tests/Parsers/ to tests/Parser/ for consistent structure
- All namespaces remain unchanged: Tomaj\BankMailsParser\Parser\{Bank}
- Regenerated autoload after directory restructure
- All 40 tests still passing, PHPStan clean

This improves project consistency where directory structure matches namespace.
@tomaj tomaj merged commit 9b6dcba into master Aug 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants