Canducci QuickResponse

v0.0.1 2015-11-25 01:02 UTC


####PHP QR Code version (1.1.4)

PHP QR Code - Site

This is PHP implementation of QR Code 2-D barcode generator. It is pure-php LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi.


Copyright (C) 2010 by Dominik Dzienia

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (LICENSE file) for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA



Fell free to contact me via e-mail (deltalab at poczta dot fm) or using folowing project pages:


Based on C libqrencode library (ver. 3.1.1) Copyright (C) 2006-2010 by Kentaro Fukuchi

QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other countries.

Reed-Solomon code encoder is written by Phil Karn, KA9Q. Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q

Canducci QuickResponse

QR Code

Canducci QuickResponse

Build Status Latest Stable Version Total Downloads Latest Unstable Version License



Para aplicações Laravel, configure dessa maneira:

Adicione em seu composer.json essa chave:

"canducci/quickresponse": "0.0.1"

Agora execute esse comando no seu console:

$ composer update


Abra o arquivo config/app.php e adicione essa linha em suas configurações de providers:

'providers' => [

Para funcionar o apelido (facade) adicione essa linha em suas configurações de aliases:

'aliases' => [

    'QuickResponse' => Canducci\QuickResponse\Facades\QuickResponse::class


Recebe uma interface de message

public function data(IMessageType $message)

Renderiza a imagem e exibe direto no navegador

public function render($level = QuickResponseLevel::L, $pixel = QuickResponsePixel::Three, 
                $frame = QuickResponseFrameSize::Two)

Cria a imagem e grava em disco no formato .png

public function saveAs($path, $level = QuickResponseLevel::L, $pixel = QuickResponsePixel::Three, 
                $frame = QuickResponseFrameSize::Two)

####A sequencia dos métodos é:

1 - Passe a interface `IMessateType` no método `data($msg)`.
2 - Depois utilize `render()` ou `saveAs()`.
3 - Sequencia: (Exemplo)    
    $msg = new \Canducci\QuickResponse\MessageText($name); 

Observação: Os métodos render e saveAs já estão formatados em um padrão, deixando livre para novas configurações.

####Como utilizar no Laravel

Para Texto ou Links:

$name = "test";
$msg = new \Canducci\QuickResponse\MessageText($name); 
$qr = new Canducci\QuickResponse\QuickResponse();

Para Telefone

$msg = new \Canducci\QuickResponse\MessagePhone(55,11,1111111);    

Para SMS

$msg = new \Canducci\QuickResponse\MessageSMS(55,11,11111111);    

Para Email Simples

$msg = new \Canducci\QuickResponse\MessageSimpleEmail('');    

Para Email Completo

$msg = new \Canducci\QuickResponse\MessageExtendedEmail('', 'Test', 'Test Complete');    

Para Skype

$msg = new \Canducci\QuickResponse\MessageSkype('');    

Cartão de Visita Simples

$people = messagePeople('Test');
$phone = messagePhone(55,11,11111111);
$msg = messageBusinessCardSimple($people, $phone);

Cartão de Visita Completo

$people = messagePeople('Test');
$phone = messagePhone(55,11,11111111);
$phone1 = messagePhone(55,18,32695189);
$phone2 = messagePhone(55,18,32695189);
$address = messageAddress('Office', '','Home','Rua, 001','Sao Paulo','SP','04500000','Brasil');
$msg = messageBusinessCardDetailed($people,$phone,$phone1,$phone2,'sobre1;test1','Home Office','', $address);

Cartão de Visita Simples com Foto

$people = messagePeople('Test');
$phone = messagePhone(55,11,11111111);
$msg = messageBusinessCardPhoto($people, $phone, file_get_contents('40x40.jpg'));


$msg = messageText('Test Laravel');
  • Save
qrSaveAs($msg, 't.png');
  • Render
return qrRender($msg); 
return quickresponse()->data($msg)->render();
return QuickResponse::data($msg)->render();

Mais Helpers

function messageText($text); 
    return new MessageText
function messagePeople($name);
    return new MessagePeople
function messageAddress($label, $pobox, $ext, $street, $town, $region, $postcode, $country);
    return new MessageAddress
function messageSkype($name);
    return new MessageSkype
function messagePhone($country,$area,$number);
    return new MessagePhone
function messageSMS($country,$area, $number);
    return new MessageSMS
function messageSimpleEmail($email);
    return new MessageSimpleEmail
function messageExtendedEmail($email, $subject, $body);
    return new MessageExtendedEmail
function messageBusinessCardSimple(IMessagePeople $people, IMessagePhone $phone);
    return new MessageBusinessCardSimple
function messageBusinessCardDetailed(IMessagePeople $people, IMessagePhone $phone, IMessagePhone $phoneprivate, 
                IMessagePhone $phonecelular,$sortName, $orgName, $email, IMessageAddress $address)
    return new MessageBusinessCardDetailed
function messageBusinessCardPhoto(IMessagePeople $people, IMessagePhone $phone, $photo);
    return new MessageBusinessCardPhoto

####Direto no navegador:


get('print', function()
    $msg = messageText('');
    return QuickResponse::data($msg)


    <img src="/print" border="0" />

####Observação: Esse pacote funciona perfeitamente fora do framework Laravel

Crie um composer.json com formato logo abaixo:

    "require": {     

Rode o comando $ composer update, e após a instalação use assim:


    require 'vendor/autoload.php';
    $msg = new Canducci\QuickResponse\MessageText('Test');
    $qr = new Canducci\QuickResponse\QuickResponse();
    echo $qr->data($msg)->render(); // saída imagem
    $qr->data($msg)->saveAs('path_da_pasta_nome_imagem'); // Exemplo: q/1.png