Regular captcha in Laminas

Code
<?php

use Laminas\Captcha\Image;

$dir = __DIR__;

$captcha = new Image([
    'wordLen' => 3,
    'imgDir' => $dir,
    'font' => __DIR__ . '/arial.ttf',
    'width' => 300,
    'height' => 80,
]);

$id = $captcha->generate();
$file = $captcha->getImgDir() .
    $id . $captcha->getSuffix();

$img = file_get_contents($file);
$img = base64_encode($img);
echo '<img src="data:image/png;base64,' . $img . '">';

// two possible user inputs.
// id = generated session id
// input = user input
$wrongInput = [
    'id' => 1,
    'input' => 'asdf',
];
$rightInput = [
    'id' => $captcha->getId(),
    'input' => $captcha->getWord(),
];

// validate user input
dump($captcha->isValid($wrongInput));
dump($captcha->isValid($rightInput));
Result
^ false

^ true
Used Versions
PHP 8.3, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8