QR-Code generation in PHP, now with bacon flavor

Monday, April 1, 2013

First of, this is not an April Fool's joke. I actually planed to make one this year, but eventually gave up. Anyway, as some of you who follow me on Twitter may know, I worked on a modern QR-Code library, known as BaconQrCode, the past few weeks. Eventually it is now fully working and the public API can be considered stable.

As a base for my implementation I had choosen the ZXing library library. After writing the first unit tests though I noted that their implementation of the Reed-Solomon codec performed rather bad in PHP, so I exchanged it with the much faster implementation by Phil Karn. As the rest of the library performed quite well and seemed much more logical, I choosed to stay with it instead of a different implementation like qrencode, which formed the base for PHP QR Code.

So far my complete implementation works, at least according to the unit tests and some personal testing. I'd like to encourage you to try it out and give me your feedback. I have implemented three different renderers so far, namely Bitmap (PNG), SVG and EPS. There is still a little bit of work to be done for me, like finishing the code-documentation, adding a few more unit tests and doing a few more PHP-specific optimizations, but all that work won't influence the public API anymore.

So, what are you waiting for? As always, you can find the library in the Bacon repository on GitHub or include it in your application via Packagist. If you are interested in more cool stuff, check out the website of of Bacon.

Oh and before I forget it. I may also add QR-Code decoding in the future. This would really be a feature you won't find in any other QR-Code library for PHP ;)

Comments to this article

  • Avatar of Carabez Reply Carabez Friday, July 11, 2014 4:01 PM

    Hi!

    Does the Qr-code generator Works with zf2?

    Thank in advance!

    • Avatar of Ben Scholzen 'DASPRiD' Reply Ben Scholzen 'DASPRiD' Friday, July 11, 2014 4:02 PM

      Of course.

  • Avatar of dams Reply dams Tuesday, August 19, 2014 1:57 PM

    Does this works with zf1 too ?

    • Avatar of Ben Scholzen 'DASPRiD' Reply Ben Scholzen 'DASPRiD' Tuesday, August 19, 2014 2:41 PM

      There's no reason it wouldn't, as long as you run PHP 5.3 or higher.

Leave a comment

Please note that your email address will not be shown, it is only used to fetch your avatar image from gravatar.com and for notifications.

     _                     
 ___(_) __ _  _____  _____ 
/ __| |/ _` |/ _ \ \/ / _ \
\__ \ | (_| |  __/>  <  __/
|___/_|\__, |\___/_/\_\___|
          |_|