gonzalo123/qrserviceprovider

QR code service provider for silex using endroid/qrcode

dev-master / 1.0.x-dev 2015-02-18 18:06 UTC

This package is not auto-updated.

Last update: 2024-12-16 15:44:16 UTC


README

Build Status

Requirements

Installation

Add in your composer.json

{
    "require": {
        "gonzalo123/qrserviceprovider": "dev-master"
    }
}

Example

use Silex\Application;
use G\QrServiceProvider;

$app = new Application();

$app->register(new QrServiceProvider(), [
    'qr.defaults' => [
        'padding'   => 5, // default: 0
        'size'      => 200,
        'imageType' => 'png', // png, gif, jpeg, wbmp (default: png)
    ]
]);

$app->get("/qr/base64/{text}", function($text) use ($app) {
    return $app['qrCode'](base64_decode($text))->getResponse();
});

$app->get("/qr/{text}", function($text) use ($app) {
    return $app['qrCode']($text)->getResponse();
});

$app->run();