QR Code generation was changed in the 1.1.x version and is now done through the QrCode wrapper that utilizes one of many available encoders.
1.1.x
QrCode
use Jocic\GoogleAuthenticator\Secret; use Jocic\GoogleAuthenticator\Account; use Jocic\GoogleAuthenticator\Encoder; use Jocic\GoogleAuthenticator\QrCode; use Jocic\GoogleAuthenticator\Encoders\Endroid;
$account = new Account(); $account->setService("My Service"); $account->setIdentifier("john@doe.com"); $account->setSecret("RMB4AMUMDHODBYNR");
$encoder = new Endroid(); $encoder->setSize(200); $encoder->setMargin(5); $encoder->setBackgroundColor("#ffffff"); $encoder->setForegroundColor("#000000"); $encoder->setFormat(Encoder::FORMAT_PNG); $encoder->setErrorCorrection(Encoder::ECC_LOW);
$qrCode = new QrCode(); $qrCode->setDirectory("/path/to/my/storage"); $qrCode->setFilename("my-code.png"); $qrCode->setEncoder($encoder); if ($qrCode->generate($account)) { echo $encoder->getEmbeddable(); }
There was an error while loading. Please reload this page.