ulabox/barcode-bundle
A Symfony bundle for generating barcodes in PHP applications. It integrates barcode rendering with Symfony and Twig, making it easy to add common barcode formats to labels, invoices, and product pages with minimal configuration.
This is a Symfony bundle (SGKBarcodeBundle), not a Laravel package — so "getting started" in a Laravel codebase means either (a) you are working in/around a Symfony app, or (b) you are mining it for its barcode-generation logic to drop into Laravel. Given the repo is archived with a single star and zero dependents, treat it as a reference implementation, not a dependency.
First places to look, in order:
composer.json — pins the Symfony version range and reveals the underlying barcode engine (it wraps a generator rather than drawing bars itself). The transitive deps here are the real constraint.src/*Bundle.php — the bundle entry point. Confirms it is Symfony-only.Resources/config/services.yml — the service IDs and the default generator class. This is what you actually need.Templating/ or Twig/) — shows the intended front-end usage and the supported output formats (SVG/PNG/HTML).Minimal "first use case" — generate a Code128 barcode for an order/shipping label. In a Symfony app that means registering the bundle in AppKernel/bundles.php and calling the generator service or the Twig function. In Laravel, the honest path is:
composer require ulabox/sgk-barcode-bundle
composer why-not ulabox/sgk-barcode-bundle
Then copy the generator service class into app/Support/Barcode/, strip its Symfony container wiring, and instantiate it directly. You get a working barcode generator without dragging symfony/dependency-injection and twig/twig into a Laravel app that does not use them.
Pattern 1 — Native Symfony (the only supported path). Register the bundle, inject the generator service into a controller or console command, and call its generate(...)-style method. Use the Twig function for inline rendering in templates.
Pattern 2 — Laravel service provider bridge. If you insist on the package as-is, create a provider that binds the generator:
// app/Providers/BarcodeServiceProvider.php
$this->app->singleton(BarcodeGenerator::class, function () {
return new BarcodeGenerator(/* config from config/barcode.php */);
});
Pull the config values (format, width, height, color) into config/barcode.php — the bundle's own config lives in YAML/XML and is not publishable in Laravel.
Pattern 3 — Blade directive. Wrap the generator in a @barcode('0123456789') directive that emits SVG inline. Prefer SVG over PNG for labels: no GD/Imagick dependency, scalable, and safe to stream in a PDF pipeline.
Pattern 4 — Bulk label generation. Barcodes for a batch of orders belong in a queued job that writes files to storage/app/barcodes/ and returns URLs/paths. Do not generate on-demand in a request loop; the underlying engine is CPU-bound on PNG output.
Pattern 5 — Extract and replace. The durable move: identify the wrapped library (likely tecnickcom/tc-lib-barcode or picqer/php-barcode-generator), depend on it directly, and delete this bundle. You lose nothing — the bundle is thin glue — and gain maintained code.
Integration tips: cache generated barcodes by (value, format) hash; store the SVG string, not a resource; keep barcode rendering out of your API responses and serve via a signed route or pre-generated file.
composer.json almost certainly constrains Symfony to an EOL major. Expect composer require to fail on a modern Laravel/Symfony stack until you pin --ignore-platform-reqs or fork.extra.laravel block, no service provider, no facade, no publishable config. Nothing wires itself up.ExtensionInterface. If you install it in Laravel you drag twig/twig, which can conflict with other view engines.symfony/config + dependency-injection. There is no config/barcode.php to publish; you must translate the Configuration tree by hand.bin/console debug:container | grep -i barcode (Symfony) or app()->bound(...) (Laravel) to confirm registration. A silent null usually means the bundle was never registered.services.yml. In Laravel, just don't use the container and instantiate your own.picqer/php-barcode-generator (Code128/EAN, no extensions) or endroid/qr-code for QR. Both are actively maintained, Laravel-friendly, and cover the same use case this bundle was written for.How can I help you explore Laravel packages today?