PHP code example of hejunjie / wechat-bill-parser

1. Go to this page and download the library: Download hejunjie/wechat-bill-parser 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/ */

    

hejunjie / wechat-bill-parser example snippets


use Hejunjie\WechatBillParser\WechatBillParser;
use Hejunjie\WechatBillParser\ParseOptions;

$zipFile = '/path/to/wechat_bill.zip';

$options = new ParseOptions($zipFile);

// Called when the password is found (return false to stop further processing)
$options->onPasswordFound = function ($password) {
    echo "Password: $password\n";
    return true;
};

// Called when data parsing is complete (return false to skip further processing)
$options->onDataParsed = function ($data) {
    echo "Nickname: " . $data['account'] . PHP_EOL;
    echo count($data['data']) . " records parsed\n";
    return true;
};

$parser = new WechatBillParser();
$parser->parse($options);

[
    'real_name' => '',              // Real name (extraction not yet implemented)
    'account'   => '18273727771',   // WeChat nickname
    'data'      => [
        // Each row is a transaction record
        ['Transaction Time', 'Transaction Type', 'Counterparty', 'Product', 'Income/Expense', 'Amount (CNY)', 'Payment Method', 'Current Status', 'Transaction ID', 'Merchant Order ID', 'Remarks'],
        // ...
    ],
]

├── bin/                    # C source code (zip_bruteforce.c)
├── src/                    # PHP source code
│   ├── WechatBillParser.php     # Main parser
│   ├── ParseOptions.php         # Parse options (callback definitions)
│   ├── ZipPasswordCracker.php   # Password cracker (invokes the C executable)
│   ├── CsvExtractor.php         # Excel data extraction
│   └── Installer.php            # C tool compilation and environment detection
├── resources/              # Compiled binary output
└── vendor/                 # Composer dependencies