PHP code example of yoosuf / barcode

1. Go to this page and download the library: Download yoosuf/barcode library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yoosuf / barcode example snippets


use Yoosuf\Barcode\Facades\Barcode;

$svg = Barcode::render('SO-1001')->contents;

$dataUri = Barcode::dataUri('SO-1001', 'png', [
    'type' => 'TYPE_CODE_128',
    'width' => 2,
    'height' => 80,
]);

$storedPath = Barcode::save('barcodes/so-1001.svg', 'SO-1001', 'svg');
bash
php artisan vendor:publish --tag=barcode-config
bash
php artisan barcode:generate SO-1001 --driver=svg --output=storage/app/barcodes/so-1001.svg
bash
php artisan barcode:generate SO-1001 --driver=svg