composer require milon/barcode
1. config/app.php
'providers' => [
// ...
Milon\Barcode\BarcodeServiceProvider::class,
]
'aliases' => [
// ...
'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
]
generator in html, png , jpeg embedded base64 code and SVG canvas
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T');
echo '';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T');
echo '';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T');
echo '';
Width and Height example
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33);
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33);
echo '';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33);
echo '';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33);
echo '';
Color
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33,'green');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33,'green');
echo '';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '';
2d
echo DNS2D::getBarcodeHTML('4445645656', 'QRCODE');
echo DNS2D::getBarcodePNGPath('4445645656', 'PDF417');
echo DNS2D::getBarcodeSVG('4445645656', 'DATAMATRIX');