PHP code example of golded-dev / laravel-ftn-hudson

1. Go to this page and download the library: Download golded-dev/laravel-ftn-hudson 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/ */

    

golded-dev / laravel-ftn-hudson example snippets




declare(strict_types=1);

use Golded\Ftn\Hudson\HudsonReader;

$reader = new HudsonReader();

foreach ($reader->read('/path/to/messages/HUDSON') as $message) {
    echo $message->msgno.PHP_EOL;
    echo $message->fromName.' -> '.$message->toName.PHP_EOL;
    echo $message->subject.PHP_EOL;
    echo $message->bodyText.PHP_EOL;
}

use Golded\Ftn\Hudson\HudsonReader;
use Golded\Ftn\ReaderOptions;

$messages = new HudsonReader()->read(
    path: '/path/to/messages/HUDSON',
    options: new ReaderOptions(fallbackCharset: 'CP437'),
);