gigablah/silex-qrcode

Silex QR Code Provider

0.0.1 2013-10-30 08:58 UTC

This package is auto-updated.

Last update: 2024-08-24 04:27:29 UTC


README

The QrCodeServiceProvider integrates the endroid/qrcode library with your Silex application.

安装

使用 Composer 将 gigablah/silex-qrcode 库添加到您的 composer.json 文件中。

{
    "require": {
        "silex/silex": "~1.0",
        "gigablah/silex-qrcode": "~0.0.1"
    }
}

用法

只需注册服务提供程序,并可选地传递一些默认值。

$app->register(new Gigablah\Silex\QrCode\QrCodeServiceProvider(), array(
    'qrcode.options' => array(
        'size' => 300,
        'padding' => 10
    )
));

您现在可以按如下方式生成 QR 码图像

$app['qrcode']->setText('http://example.org');

return new Symfony\Component\HttpFoundation\Response(
    $app['qrcode']->get('png'),
    200,
    array('Content-Type' => 'image/png')
);

待办事项

  • 包装 QrCode 类以提供流畅的接口

许可

在 MIT 许可证下发布。有关详细信息,请参阅 LICENSE 文件。