PHP code example of laxit / sigil

1. Go to this page and download the library: Download laxit/sigil 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/ */

    

laxit / sigil example snippets


use Laxit\Sigil\Encoder;

$encoder = new Encoder();

use Laxit\Sigil\Renderer\AsciiRenderer;

echo (new AsciiRenderer($encoder))->render(7323);

use Laxit\Sigil\Renderer\SvgRenderer;

echo (new SvgRenderer($encoder))->render(7323);

new SvgRenderer($encoder, stroke: 'currentColor', strokeWidth: 8);

use Laxit\Sigil\Renderer\DxfRenderer;

file_put_contents('7323.dxf', (new DxfRenderer($encoder))->render(7323));

$wide = new Encoder(rows: 3);          // 6 places, 0-999999
$wide->digitsOf(123456);               // ones 6, tens 5, ... hundredThousands 1

Encoder::fitting(12345678);            // picks the 4 rows it needs
Encoder::maxFor(4);                    // 99999999

(new Encoder())->render(12345);        // InvalidArgumentException, not a wrong glyph

$encoder = new Encoder(stemHeight: 100, quadrantWidth: 35, stemX: 50, stemTopY: 10);
bash
php bin/demo.php 7323 ascii   # also: svg, dxf, all
bash
composer install
php examples/01-basics.php 7323
bash
php bin/vectors.php            # rewrite ../fixtures/vectors.json
php bin/vectors.php --check    # CI: exit 1 if the committed fixtures are stale