I would like to use a QR-Code generator with my Laravel 4.1 application. I am currently choosing between https://github.com/endroid/QrCode and https://github.com/endroid/EndroidQrCodeBundle. To be honest though, neither appear to have any documentation on how to use them.
Can someone describe the first steps, after an successful composer installation, on how to produce QR codes?
Thank you in advance for every step. I know this is kind of a generic question, but I am kind of new to Laravel.
I don't know if this late response but for anyone who is having this challenge, this is fairly simple;
<?php namespace App\Http\Controllers
use Endroid\QrCode\QrCode;
class ImageController extends Controller{
public function _construct(QrCode $qrCode){
$this->qrCode = $qrCode;
}
public function makeQrCode($text){
return $this->qrCode
->setText($text)
->setSize(300)
->setPadding(10)
->setErrorCorrection('high')
->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))
->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))
->setLabel('My label')
->setLabelFontSize(16)
->render();
}
}
You route may look like this:
Route::get('image/qrcode/{$text}',[
'uses' => 'ImageController@makeQrCode',
'as' => 'qrcode'
]);
So later you can do this in your blade:
<img src="{!! route('qrcode',['text'=>'Hello world']) !!}" alt="QR Code">