I am trying to implement a third-party library in a cakePHP 2.0 project. I would like to use PHP QR Code to create QRCodes.
I created a new folder in app/Plugin called QrCode and put the library in the Vendor folder of my new plugin.
I created a component in Controller/Component called QrGeneratorComponent with this content:
<?php App::import('Vendor', 'phpqrcode'.DS.'qrlib'); // Component defined in 'QrCode' plugin class QrGeneratorComponent extends Component { public function test() { return QRcode::png('PHP QR Code :)'); } }
In my application, I added the component public $components = array('QrCode.QrGenerator'); and tried to access my test method: $this->QrGenerator->test();
But I always get this error:
Fatal error: Class 'QRcode' not found in C: \ xampp \ htdocs \ cake \ app \ Plugin \ QrCode \ Controller \ Component \ QrGeneratorComponent.php on line 8
So what am I wrong? Is there a better way to implement a third-party library?
source share