Skip to content

tanvirismail/barcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Laravel Barcode Generator

supported barcode format: CODE39, CODE128

barcode

use TanvirIsmail\Barcode\Barcode;

$barcode = new Barcode;
$barcode->code('200300001');
$barcode->type('code39');  // code39, code128
$barcode->height(100);
$barcode->barWidth(2);
$barcode->margin(10);
$barcode->background([255, 255, 255]); // transparent = [0, 0, 0, 127]
$barcode->barColor([[0, 0, 0],[255, 255, 255]]);
$barcode->showcode();
$barcode->label('barcode');
$barcode->labelPosition('right'); // center , left, right

response as image

$barcode->responseHeader();
echo $barcode->build();
// for laravel
response($barcode->build())->header('Content-Type', $barcode->getContentType());

view as image

echo '<img src="data:image/png;base64,' . base64_encode($barcode->build()) . '">';

save

$barcode->extension('png');  // jpeg, png
$barcode->path('barcode.png');  // path with file name
$barcode->save();

download

$barcode->download(); 
// if download as file name
$barcode->extension('png'); // default 'png'
$barcode->download('test'); // file name without extention

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages