max13/laravel-barcode
Composer 安装命令:
composer require max13/laravel-barcode
包简介
Laravel package to manage and generate barcodes
README 文档
README
With this package you can manage barcodes (external barcodes, checkings, etc…) or generate your own as long as you configure it correctly.
Installation
You can install the package via composer:
composer require max13/laravel-barcode
This package embeds corresponding fonts to write the barcode on a webpage. You will see how to use them in the Usage section below.
Configuration
Barcode types are available like so (defaults to ean13):
| type | has font |
|---|---|
| ean8 | yes |
| ean13 | yes |
To change the barcode type used, set to your .env file: BARCODE_TYPE= with the barcode type you want to use.
When a barcode has a font and you would use it, you need to publish the package assets using:
php artisan vendor:publish --provider="Max13\Barcode\ServiceProvider" --tag=public
Don’t forget to include the css files in your layouts.
If you need to see or change this package config file, you can publish the config file using this command:
php artisan vendor:publish --provider="Max13\Barcode\ServiceProvider" --tag=config
This will export the config file to your app’s config folder.
Usage
// To check an ean13 barcode: if (Barcode::isValid('0123456789104')) { // This barcode is valid } // To calculate an ean13 barcode check digit (the last digit) echo Barcode::checksum('012345678910'); // Show: '4' // To fix an ean13 barcode if it's needed echo Barcode::fix('0123456789100'); // Show: '0123456789104'
And finally, if you need to write the barcode using the embedded font, you need to get the encoded form of the barcode (ex: in case of ean13, the font will be applied on html class f-ean13):
<span class="f-ean13">{{ Barcode::encode('0123456789104') }}</span>
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
max13/laravel-barcode 适用场景与选型建议
max13/laravel-barcode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 255 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 01 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「barcode」 「max13」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 max13/laravel-barcode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 max13/laravel-barcode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 max13/laravel-barcode 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bundle providing a password encoder stack for support of legacy user data.
Symfony 4, 5, 6 ,7 Barcode Generator Bundle with Twig function extension
GS1 parser and generator for PHP
Symfony2 Barcode Generator Bundle with Twig function extension
PHP QR code decoder / reader
Laravel package fixing SQLite Schema grammar
统计信息
- 总下载量: 255
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-16