定制 karmabunny/bacon-backends 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

karmabunny/bacon-backends

最新稳定版本:v1.0.0

Composer 安装命令:

composer require karmabunny/bacon-backends

包简介

README 文档

README

Some extra backends for Bacon QR.

These might work a bit more reliably than others, particularly in constrained hosting environments.

  • ImagickDumbBackEnd
  • GdImageBackEnd

ImagickDumbBackEnd

The built-in imagick backend is (currently) broken in PHP 8. So this is a backend that wraps the SVG backend and pipes it through the convert CLI tool provided by imagick.

Generally we've found the PHP imagick extension a bit questionable anyway. Sprout 3, for example, departed from the imagick extensions in Sprout 2 and uses the convert tool exclusively.

Caveats: Might not work on Windows. Makes heavy use of proc_open().

GdImageBackEnd

This is a very limited backend but has enough bits to draw a basic QR code.

GD is widely available, more than imagick. So this is a big win for those tight environments.

Caveats: Many.

  • No gradients.
  • No rotation.
  • No layers.
  • No curves or ellipsis.

You might ask, why not write a renderer instead of an image backend? The answer is - I didn't even realise that was an option. It might be easier, might be harder. Might actually be far more robust. So maybe that's a thing for the future.

Usage

use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
use BaconQrCode\Writer;
use karmabunny\BaconBackends\GdImageBackEnd;
use karmabunny\BaconBackends\ImagickDumbBackEnd;

$renderer = new ImageRenderer(
    new RendererStyle(400),
    new ImagickDumbBackEnd(),
    // or new GdImageBackEnd(),
);
$writer = new Writer($renderer);
$writer->writeFile('Hello World!', 'qrcode.png');

Contributing

Be sure to write a test. We've got some pretty funky stuff going on in there but it validates the use case.

Run tests with composer test.

Pleas also run composer analyse over anything before releasing.

Future

Some things to do, for fun and profit.

  • GD renderer (as opposed to the image backend)
  • HTML renderer

统计信息

  • 总下载量: 316
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固