Skip to content

Instantly share code, notes, and snippets.

@kaystrobach
Last active May 20, 2022 07:01
Show Gist options
  • Select an option

  • Save kaystrobach/7aa08be92373be66efb6a1d36705d1b1 to your computer and use it in GitHub Desktop.

Select an option

Save kaystrobach/7aa08be92373be66efb6a1d36705d1b1 to your computer and use it in GitHub Desktop.

Revisions

  1. kaystrobach revised this gist May 19, 2022. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion CreateBarCode.php
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,9 @@
    // needs picqer/php-barcode-generator

    $generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
    $barcode = $generator->getBarcode($data, $generator::TYPE_CODE_128, 3, 100, [0,0,0]);
    $barcode = $generator->getBarcode($data, $generator::TYPE_CODE_128, 3, 100, [0,0,0]);

    // ensure the char count is even for CODE_128_C
    $barcodeData = (strlen($data) % 2) === 0 ? $data : '0' . $data;
    $generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
    $barcode = $generator->getBarcode($barcodeData, $generator::TYPE_CODE_128_C, 3, 100, [0,0,0]);
  2. kaystrobach created this gist May 19, 2022.
    6 changes: 6 additions & 0 deletions CreateBarCode.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    <?php

    // needs picqer/php-barcode-generator

    $generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
    $barcode = $generator->getBarcode($data, $generator::TYPE_CODE_128, 3, 100, [0,0,0]);
    18 changes: 18 additions & 0 deletions UuidConverterService.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    <?php

    // needs ramsey/uuid

    class UuidConverterService
    {
    public static function fromUuidToNumberString(string $uuid): string
    {
    $uuidObject = Uuid::fromString($uuid);
    return $uuidObject->getInteger()->toString();
    }

    public static function fromNumberStringToUuid(string $integer): string
    {
    $uuidObject = Uuid::fromInteger($integer);
    return $uuidObject->toString();
    }
    }