lembadm / yii2-barcode-validator
Barcode validator
Installs: 1 394
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2022-04-10 12:01:36 UTC
README
Validate Code39
, EAN8
, EAN12
, EAN13
, ITF14
barcodes
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist lembadm/yii2-barcode-validator "*"
or add
"lembadm/yii2-barcode-validator": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your model validation rules :
<?php class Product extends ActiveRecord { public function rules() { return [ // Barcode [[barcode]] ['barcode', 'required'], ['barcode', 'string', 'max' => 255], ['barcode', BarcodeValidator::className(), 'typeAttribute' => 'code_type'], // Barcode type [[code_type]] ['code_type', 'required'], ]; } }