Create barcodes with Laminas

Code
<?php

use Laminas\Barcode\Object\Code128;
use 
Laminas\Barcode\Renderer\Image;

$barcode = new Code128([
    
'text' => 'PHP Snippets',
    
'barHeight' => 60,
    
'factor' => 2,
]);

$renderer = new Image([
    
'resource' => imagecreate($barcode->getWidth(), $barcode->getHeight()),
    
'barcode' => $barcode,
]);

ob_start();
$renderer->render();
$image base64_encode(ob_get_contents());
ob_end_clean();
echo 
'<img src="data:image/png;base64,' $image '">';
Result
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8