PHP Barcode and QRCode Reader and Generator: Generate barcodes and qrcodes for printing

Recommend this page to a friend!
  Info   View files Documentation   View files View files (34)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-06-23 (20 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: 3 This week: 3All time: 9,982 This week: 86Up
Version License PHP version Categories
d3codes 1.0Freeware7.2PHP 5, Graphics, Printing
Description Author

This package can be used to generate barcodes and qrcodes for printing.

It provides components to generate barcodes and qrcodes reading their strings that define them from forms.

The package can generate the code strings in a way that they can be easily printed from a Web browser.

Name: Uldis Nelsons <contact>
Classes: 8 packages by
Country: Latvia Latvia
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Details

Codes"

Features

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require d3yii2/d3codes "*"

or add

"d3yii2/d3codes": "*"

to the require section of your composer.json file.

Configuration

recorder and Readers

 'components' => [
        'palletCodeRecorder' => [
            'class' => 'd3yii2\d3codes\components\CodeRecorder',
            'codeName' => 'pallets bar code',
            'series' => [
                'p01' => [
                    'prefix' => 'p01',
                    'length' => 5,
                    'from' => 1,
                    'to' => 20000
                ]
            ],
            'modelClass' => 'wood\clasifiers\models\Pallet',
            'componentsSysModel' => 'sysModel'
        ],
        'codeReader' => [
            'class' => 'd3yii2\d3codes\components\CodeReader',
            'modelClassList' => [
                'wood\clasifiers\models\Pallet'
            ],
            'componentsSysModel' => 'sysModel'
        ],
    ]
        

Printer

For printing direct from the server. Use Chrome for converting to PDF and for sending to printer use PDFtoPrinter http://www.columbia.edu/~em36/pdftoprinter.html

To composer add repository https://github.com/uldisn/php-exec.git

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/uldisn/php-exec.git"
        },

# Bar code printer
BOUNCER_PRINTER=BouncerPrinter
PDFtoPrinter=H:\yii2\cewood\PDFtoPrinter.exe

# chrome
CHROME_PATH=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

 'components' => [
        'bouncerPrinter' => [
            'class' => '\d3yii2\d3codes\components\PrintWindowsPrinter',
            'printerName' => getenv('BOUNCER_PRINTER'),
            'chromeExe' => getenv('CHROME_PATH'),
            'PDFtoPrinter' => getenv('PDFtoPrinter'),
        ],
    ]
        

Usage

creating new barcode


    $barCode = \Yii::$app->palletCodeRecorder->createNewRecord($palletModel->id);
    $palletModel = \Yii::$app->palletCodeRecorder->codeReader($barcodeReadedByBarCodeScaner);       

adding code to model

class BtlinePp extends BaseBtlinePp
{

    public function rules()
    {
        return array_merge(parent::rules(),[
            ['code','safe']
        ]);
    }

    public function attributeLabels()
    {
        return array_merge(parent::attributeLabels(),[
            'code' => 'Code'
        ]);
    }

    /
     * @return string
     * @throws D3ActiveRecordException
     */
    public function getCode(): string
    {
        return Yii::$app->ppCodeRecorder->getCodeOrCreate($this->id);
    }
}

Print barcode by printer

use d3yii2\d3codes\actions\PrintCode;
class BatchController
{

    public function actions() {
        $OC = $this;
        return [
            'pp-print-barcode' => [
                'class' => PrintCode::class,
                'componentRecorderName' => 'ppCodeRecorder',
                'layout' => '@layout_barcode',
                'view' => 'print_barcode',
                'data' => static function(int $id) use ($OC){
                    return [
                        'model' => $OC->findModel($id),
                    ];
                }
            ],
        ];
    }
}

reading in Controller and Form

For form use model d3yii2\d3codes\models\CodeReader.

Controller

use d3yii2\d3codes\models\CodeReader;

        $codeReaderModel = new CodeReader();
        $codeReaderModel->componentCodeReaderName = 'codeReader';
        $post = Yii::$app->request->post();
        if($post && $codeReaderModel->load(Yii::$app->request->post())){
                    / @var CwpalletPallet $palletModel */
                    $palletModel = $codeReaderModel->model;
        }
        if ($codeReaderModel->hasErrors()) {
            FlashHelper::modelErrorSummary($codeReaderModel);
        }        
        return $this->render('manufacturing', [
            'packList' =>  $searchModel
                ->manufacturedPacks(true)
                ->all(),
            'packId' => $packId,
            'codeReaderModel' => $codeReaderModel
        ]);        

form

                $form = ActiveForm::begin([
                    'id' => 'BauncerCodeReading',
                    'enableClientValidation' => false,
                    'errorSummaryCssClass' => 'error-summary alert alert-error',
                    'fieldConfig' => [
                        'template' => "{label}\n{beginWrapper}\n{input}\n{error}\n{endWrapper}",
                    ],

                ]);
                echo $form
                    ->field(
                        $codeReaderModel,
                        'code',
                        [
                            'inputOptions' => [
                                'autofocus' => 'autofocus',
                                'class' => 'form-control',
                                'tabindex' => '1'
                            ]
                        ])
                    ->textInput()
                    ->label('');


                echo ThButton::widget([
                    'label' => 'Process',
                    'id' => 'saveCode',
                    'icon' => ThButton::ICON_CHECK,
                    'type' => ThButton::TYPE_SUCCESS,
                    'submit' => true,
                    'htmlOptions' => [
                        'name' => 'action',
                        'value' => 'save',
                    ],
                ]);
                ActiveForm::end();

Print from server

        try {
            
            $url = Yii::$app->urlManager->createAbsoluteUrl([
                '/cwstore/pack/print-barcode',
                'id' => $id
            ]);
            if(Yii::$app->bouncerPrinter->print($url)){
                FlashHelper::addSuccess('Eti?ete nos?t?ta uz izsit?ja printera');
            }else{
                FlashHelper::addDanger('Rad?s k??da druk?jot eti?eti');
            }
        } catch (Exception $e) {
            FlashHelper::processException($e);
        }


  Files folder image Files  
File Role Description
Files folder imageactions (2 files)
Files folder imageassetbundles (1 file)
Files folder imageassets (1 file)
Files folder imagecomponents (4 files)
Files folder imagedictionaries (2 files)
Files folder imagedoc (1 file)
Files folder imagegii (4 files)
Files folder imagemigrations (2 files)
Files folder imagemodels (6 files, 1 directory)
Files folder imageviews (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file Module.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  actions  
File Role Description
  Plain text file PrintCode.php Class Class source
  Plain text file Read.php Class Class source

  Files folder image Files  /  assetbundles  
File Role Description
  Plain text file NormalizeAsset.php Class Class source

  Files folder image Files  /  assets  
File Role Description
  Accessible without login Plain text file normalize.min.css Data Auxiliary data

  Files folder image Files  /  components  
File Role Description
  Plain text file CodeReader.php Class Class source
  Plain text file CodeRecorder.php Class Class source
  Plain text file PrintWindowsPrinter.php Class Class source
  Plain text file Serries.php Class Class source

  Files folder image Files  /  dictionaries  
File Role Description
  Plain text file D3CodesCodeDictionary.php Class Class source
  Plain text file D3CodesSerriesDictionary.php Class Class source

  Files folder image Files  /  doc  
File Role Description
  Accessible without login Plain text file DbSchema.schemaxml Data Auxiliary data

  Files folder image Files  /  gii  
File Role Description
  Accessible without login Plain text file d3codes_codeGiiantModel.json Data Auxiliary data
  Accessible without login Plain text file d3codes_code_queueGiiantModel.json Data Auxiliary data
  Accessible without login Plain text file d3codes_code_recordGiiantModel.json Data Auxiliary data
  Accessible without login Plain text file d3codes_seriesGiiantModel.json Data Auxiliary data

  Files folder image Files  /  migrations  
File Role Description
  Plain text file m200110_110707_init.php Class Class source
  Plain text file m200208_190707_queue_create.php Class Class source

  Files folder image Files  /  models  
File Role Description
Files folder imagebase (4 files)
  Plain text file CodeReader.php Class Class source
  Plain text file D3CodesCode.php Class Class source
  Plain text file D3CodesCodeQueue.php Class Class source
  Plain text file D3CodesCodeRecord.php Class Class source
  Plain text file D3CodesSeries.php Class Class source
  Plain text file SysModels.php Class Class source

  Files folder image Files  /  models  /  base  
File Role Description
  Plain text file D3CodesCode.php Class Class source
  Plain text file D3CodesCodeQueue.php Class Class source
  Plain text file D3CodesCodeRecord.php Class Class source
  Plain text file D3CodesSerries.php Class Class source

  Files folder image Files  /  views  
File Role Description
Files folder imagelayouts (4 files)

  Files folder image Files  /  views  /  layouts  
File Role Description
  Accessible without login Plain text file label.php Example Example script
  Accessible without login Plain text file label_GodexBP500L_6X6.php Example Example script
  Accessible without login Plain text file label_Micra106_12_95X150.php Example Example script
  Accessible without login Plain text file label_simple.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:3
This week:3
All time:9,982
This week:86Up

For more information send a message to info at phpclasses dot org.