diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 671cc402..defda120 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -23,13 +23,10 @@ jobs: strategy: fail-fast: false matrix: - php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"] + php-version: ["8.0", "8.1", "8.2"] experimental: [false] os: [ubuntu-latest] coverage-extension: [pcov] - include: - - { php-version: '5.6', experimental: false, os: ubuntu-latest, coverage-extension: 'xdebug' } - - { php-version: '7.1', experimental: false, os: ubuntu-latest, coverage-extension: 'xdebug' } steps: - uses: actions/checkout@v4 - name: Use php ${{ matrix.php-version }} diff --git a/.gitignore b/.gitignore index a7fa8a26..4dd7d5e8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,11 +8,13 @@ **/auth.json **/nbproject **/temp.php +**/test.php .phpdoc .phpunit.cache .phpunit.result.cache composer.lock -example/test.php +ecs.php phpunit.xml +rector.php target vendor diff --git a/Makefile b/Makefile index 2417f236..88aa4005 100644 --- a/Makefile +++ b/Makefile @@ -163,7 +163,7 @@ endif deps: ensuretarget rm -rf ./vendor/* ($(COMPOSER) install -vvv --no-interaction) - curl --silent --show-error --fail --location --output ./vendor/phpstan.phar https://github.com/phpstan/phpstan/releases/download/1.10.38/phpstan.phar \ + curl --silent --show-error --fail --location --output ./vendor/phpstan.phar https://github.com/phpstan/phpstan/releases/download/1.10.41/phpstan.phar \ && chmod +x ./vendor/phpstan.phar # Generate source code documentation diff --git a/README.md b/README.md index 8cf85961..85eaa2b9 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ All artifacts are generated in the target directory. Examples are located in the `example` directory. -Start a development server (requires at least PHP 5.6) using the command: +Start a development server (requires PHP 8.0+) using the command: ``` make server @@ -147,7 +147,7 @@ Create a composer.json in your projects root-directory: ```json { "require": { - "tecnickcom/tc-lib-barcode": "^1.18" + "tecnickcom/tc-lib-barcode": "^2.0" } } ``` @@ -155,7 +155,7 @@ Create a composer.json in your projects root-directory: Or add to an existing project with: ```bash -composer require tecnickcom/tc-lib-barcode ^1.18 +composer require tecnickcom/tc-lib-barcode ^2.0 ``` ## Packaging diff --git a/VERSION b/VERSION index a67b05e8..f1547e6d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.4 +2.0.7 diff --git a/composer.json b/composer.json index 48b24a7f..49f123a9 100644 --- a/composer.json +++ b/composer.json @@ -53,18 +53,18 @@ } ], "require": { - "php": ">=5.6", + "php": ">=8.0", "ext-bcmath": "*", "ext-date": "*", "ext-gd": "*", "ext-pcre": "*", - "tecnickcom/tc-lib-color": "^1.14" + "tecnickcom/tc-lib-color": "^2.0" }, "require-dev": { "pdepend/pdepend": "2.13.0", "phpmd/phpmd": "2.13.0", - "phpunit/phpunit": "10.1.2 || 9.6.7 || 8.5.31 || 7.5.20 || 6.5.14 || 5.7.27 || 4.8.36", - "squizlabs/php_codesniffer": "3.7.2 || 2.9.2" + "phpunit/phpunit": "10.1.2 || 9.6.13", + "squizlabs/php_codesniffer": "3.7.2" }, "autoload": { "psr-4": { diff --git a/example/index.php b/example/index.php index 8d0f0cfd..3d4b3fb1 100644 --- a/example/index.php +++ b/example/index.php @@ -14,75 +14,75 @@ */ // autoloader when using Composer -require ('../vendor/autoload.php'); +require(__DIR__ . '/../vendor/autoload.php'); // autoloader when using RPM or DEB package installation //require ('/usr/share/php/Com/Tecnick/Barcode/autoload.php'); // data to generate for each barcode type -$linear = array( - 'C128A' => array('0123456789', 'CODE 128 A'), - 'C128B' => array('0123456789', 'CODE 128 B'), - 'C128C' => array('0123456789', 'CODE 128 C'), - 'C128' => array('0123456789', 'CODE 128'), - 'C39E+' => array('0123456789', 'CODE 39 EXTENDED + CHECKSUM'), - 'C39E' => array('0123456789', 'CODE 39 EXTENDED'), - 'C39+' => array('0123456789', 'CODE 39 + CHECKSUM'), - 'C39' => array('0123456789', 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9'), - 'C93' => array('0123456789', 'CODE 93 - USS-93'), - 'CODABAR' => array('0123456789', 'CODABAR'), - 'CODE11' => array('0123456789', 'CODE 11'), - 'EAN13' => array('0123456789', 'EAN 13'), - 'EAN2' => array('12', 'EAN 2-Digits UPC-Based Extension'), - 'EAN5' => array('12345', 'EAN 5-Digits UPC-Based Extension'), - 'EAN8' => array('1234567', 'EAN 8'), - 'I25+' => array('0123456789', 'Interleaved 2 of 5 + CHECKSUM'), - 'I25' => array('0123456789', 'Interleaved 2 of 5'), - 'IMB' => array('01234567094987654321-01234567891', 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200'), - 'IMBPRE' => array('AADTFFDFTDADTAADAATFDTDDAAADDTDTTDAFADADDDTFFFDDTTTADFAAADFTDAADA', 'IMB pre-processed'), - 'KIX' => array('0123456789', 'KIX (Klant index - Customer index)'), - 'MSI+' => array('0123456789', 'MSI + CHECKSUM (modulo 11)'), - 'MSI' => array('0123456789', 'MSI (Variation of Plessey code)'), - 'PHARMA2T' => array('0123456789', 'PHARMACODE TWO-TRACKS'), - 'PHARMA' => array('0123456789', 'PHARMACODE'), - 'PLANET' => array('0123456789', 'PLANET'), - 'POSTNET' => array('0123456789', 'POSTNET'), - 'RMS4CC' => array('0123456789', 'RMS4CC (Royal Mail 4-state Customer Bar Code)'), - 'S25+' => array('0123456789', 'Standard 2 of 5 + CHECKSUM'), - 'S25' => array('0123456789', 'Standard 2 of 5'), - 'UPCA' => array('72527273070', 'UPC-A'), - 'UPCE' => array('725277', 'UPC-E'), -); +$linear = [ + 'C128A' => ['0123456789', 'CODE 128 A'], + 'C128B' => ['0123456789', 'CODE 128 B'], + 'C128C' => ['0123456789', 'CODE 128 C'], + 'C128' => ['0123456789', 'CODE 128'], + 'C39E+' => ['0123456789', 'CODE 39 EXTENDED + CHECKSUM'], + 'C39E' => ['0123456789', 'CODE 39 EXTENDED'], + 'C39+' => ['0123456789', 'CODE 39 + CHECKSUM'], + 'C39' => ['0123456789', 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9'], + 'C93' => ['0123456789', 'CODE 93 - USS-93'], + 'CODABAR' => ['0123456789', 'CODABAR'], + 'CODE11' => ['0123456789', 'CODE 11'], + 'EAN13' => ['0123456789', 'EAN 13'], + 'EAN2' => ['12', 'EAN 2-Digits UPC-Based Extension'], + 'EAN5' => ['12345', 'EAN 5-Digits UPC-Based Extension'], + 'EAN8' => ['1234567', 'EAN 8'], + 'I25+' => ['0123456789', 'Interleaved 2 of 5 + CHECKSUM'], + 'I25' => ['0123456789', 'Interleaved 2 of 5'], + 'IMB' => ['01234567094987654321-01234567891', 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200'], + 'IMBPRE' => ['AADTFFDFTDADTAADAATFDTDDAAADDTDTTDAFADADDDTFFFDDTTTADFAAADFTDAADA', 'IMB pre-processed'], + 'KIX' => ['0123456789', 'KIX (Klant index - Customer index)'], + 'MSI+' => ['0123456789', 'MSI + CHECKSUM (modulo 11)'], + 'MSI' => ['0123456789', 'MSI (Variation of Plessey code)'], + 'PHARMA2T' => ['0123456789', 'PHARMACODE TWO-TRACKS'], + 'PHARMA' => ['0123456789', 'PHARMACODE'], + 'PLANET' => ['0123456789', 'PLANET'], + 'POSTNET' => ['0123456789', 'POSTNET'], + 'RMS4CC' => ['0123456789', 'RMS4CC (Royal Mail 4-state Customer Bar Code)'], + 'S25+' => ['0123456789', 'Standard 2 of 5 + CHECKSUM'], + 'S25' => ['0123456789', 'Standard 2 of 5'], + 'UPCA' => ['72527273070', 'UPC-A'], + 'UPCE' => ['725277', 'UPC-E'], +]; -$square = array( - 'LRAW' => array('0101010101', '1D RAW MODE (comma-separated rows of 01 strings)'), - 'SRAW' => array('0101,1010', '2D RAW MODE (comma-separated rows of 01 strings)'), - 'AZTEC' => array('ABCDabcd01234', 'AZTEC (ISO/IEC 24778:2008)'), - 'AZTEC,50,A,A' => array('ABCDabcd01234', 'AZTEC (ISO/IEC 24778:2008)'), - 'PDF417' => array('0123456789', 'PDF417 (ISO/IEC 15438:2006)'), - 'QRCODE' => array('0123456789', 'QR-CODE'), - 'QRCODE,H,ST,0,0' => array('abcdefghijklmnopqrstuvwxy0123456789', 'QR-CODE WITH PARAMETERS'), - 'DATAMATRIX' => array('0123456789', 'DATAMATRIX (ISO/IEC 16022) SQUARE'), - 'DATAMATRIX,R' => array('0123456789012345678901234567890123456789', 'DATAMATRIX Rectangular (ISO/IEC 16022) RECTANGULAR'), - 'DATAMATRIX,S,GS1' => array(chr(232).'01095011010209171719050810ABCD1234'.chr(232).'2110', 'GS1 DATAMATRIX (ISO/IEC 16022) SQUARE GS1'), - 'DATAMATRIX,R,GS1' => array(chr(232).'01095011010209171719050810ABCD1234'.chr(232).'2110', 'GS1 DATAMATRIX (ISO/IEC 16022) RECTANGULAR GS1'), -); +$square = [ + 'LRAW' => ['0101010101', '1D RAW MODE (comma-separated rows of 01 strings)'], + 'SRAW' => ['0101,1010', '2D RAW MODE (comma-separated rows of 01 strings)'], + 'AZTEC' => ['ABCDabcd01234', 'AZTEC (ISO/IEC 24778:2008)'], + 'AZTEC,50,A,A' => ['ABCDabcd01234', 'AZTEC (ISO/IEC 24778:2008)'], + 'PDF417' => ['0123456789', 'PDF417 (ISO/IEC 15438:2006)'], + 'QRCODE' => ['0123456789', 'QR-CODE'], + 'QRCODE,H,ST,0,0' => ['abcdefghijklmnopqrstuvwxy0123456789', 'QR-CODE WITH PARAMETERS'], + 'DATAMATRIX' => ['0123456789', 'DATAMATRIX (ISO/IEC 16022) SQUARE'], + 'DATAMATRIX,R' => ['0123456789012345678901234567890123456789', 'DATAMATRIX Rectangular (ISO/IEC 16022) RECTANGULAR'], + 'DATAMATRIX,S,GS1' => [chr(232) . '01095011010209171719050810ABCD1234' . chr(232) . '2110', 'GS1 DATAMATRIX (ISO/IEC 16022) SQUARE GS1'], + 'DATAMATRIX,R,GS1' => [chr(232) . '01095011010209171719050810ABCD1234' . chr(232) . '2110', 'GS1 DATAMATRIX (ISO/IEC 16022) RECTANGULAR GS1'], +]; $barcode = new \Com\Tecnick\Barcode\Barcode(); -$examples = '
'.$bobj->getHtmlDiv().'
'."\n"; + $bobj = $barcode->getBarcodeObj($type, $code[0], -3, -30, 'black', [0, 0, 0, 0]); + $examples .= '' . $bobj->getHtmlDiv() . '
' . "\n"; } -$examples .= ''.$bobj->getHtmlDiv().'
'."\n"; + $bobj = $barcode->getBarcodeObj($type, $code[0], -4, -4, 'black', [0, 0, 0, 0]); + $examples .= '' . $bobj->getHtmlDiv() . '
' . "\n"; } -$bobj = $barcode->getBarcodeObj('QRCODE,H', 'https://tecnick.com', -4, -4, 'black', array(-2, -2, -2, -2))->setBackgroundColor('#f0f0f0'); +$bobj = $barcode->getBarcodeObj('QRCODE,H', 'https://tecnick.com', -4, -4, 'black', [-2, -2, -2, -2])->setBackgroundColor('#f0f0f0'); echo " @@ -105,17 +105,17 @@This is an usage example of tc-lib-barcode library.
getPngData())."\" />
+getPngData()) . "\" />
".$bobj->getSvgCode()."
+" . $bobj->getSvgCode() . "
".$bobj->getHtmlDiv()."
+" . $bobj->getHtmlDiv() . "
".$bobj->getGrid(json_decode('"\u00A0"'), json_decode('"\u2584"'))."+
" . $bobj->getGrid(json_decode('"\u00A0"'), json_decode('"\u2584"')) . "
".$bobj->getGrid()."+
" . $bobj->getGrid() . "