1.7.4 2016-07-26 09:39 UTC


By endroid

Latest Stable Version Build Status Total Downloads Monthly Downloads License

This library based on QRcode Perl CGI & PHP scripts by Y. Swetake helps you generate images containing a QR code.


Use Composer to install the library.

$ composer require endroid/qrcode

Then, require the vendor/autoload.php file to enable the autoloading mechanism provided by Composer. Otherwise, your application won't be able to find the classes of this library.

Of course you can also download the library and build your own autoloader.


use Endroid\QrCode\QrCode;

$qrCode = new QrCode();
    ->setText('Life is too short to be generating QR codes')
    ->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))
    ->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))
    ->setLabel('Scan the code')

// now we can directly output the qrcode
header('Content-Type: '.$qrCode->getContentType());

// save it to a file

// or create a response object
$response = new Response($qrCode->get(), 200, array('Content-Type' => $qrCode->getContentType()));

QR Code


You can use EndroidQrCodeBundle to integrate this service in your Symfony application.


Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.


This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.