1. Go to this page and download the library: Download ofcold/qrcode library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ofcold / qrcode example snippets
QrCode::generate($text);
// The generate method has a second parameter that will accept a filename and path to save the QrCode.
QrCode::generate($text, 'public/qrcode.svg');
use Ofcold\QrCode\Facades\QrCode;
use Ofcold\QrCode\HexToRgb;
$text = 'Happy New Year';
// Default output svg format file.
QrCode::generate($text);
use Ofcold\QrCode\QRcodeResponse
new QRcodeResponse(QrCode::generate($text))
// Output other file formats.
QrCode::format('png')
->generate($text);
// You can change the size of a QrCode by using the size method. Simply specify the size desired in pixels using the following syntax:
QrCode::size(400)
->generate($text);
QrCode::margin(100)->generate($text);
QrCode::errorCorrection(1)->generate($text);
QrCode::encoding('UTF-8')->generate($text);
QrCode::merge($filename, $percentage, $absolute);
// Generates a QrCode with an image centered in the middle.
QrCode::format('png')->merge('path-to-image.png')->generate();
// Generates a QrCode with an image centered in the middle. The inserted image takes up 20% of the QrCode.
QrCode::format('png')->merge('path-to-image.png', .2)->generate();
// Generates a QrCode with an image centered in the middle. The inserted image takes up 20% of the QrCode.
QrCode::format('png')->merge('http://ofcold.com/icon.png', .2, true)->generate();
QrCode::mergeString(Storage::get('path/to/image.png'), $percentage);
// Generates a QrCode with an image centered in the middle.
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
// Generates a QrCode with an image centered in the middle. The inserted image takes up 20% of the QrCode.
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .2)->generate();
QrCode::BTC($address, $amount);
//Sends a 0.334BTC payment to the address
QrCode::BTC('bitcoin address', 0.334);
// Sends a 0.334BTC payment to the address with some optional arguments
QrCode::size(500)->BTC('address', 0.0034, [
'label' => 'my label',
'message' => 'my message',
'returnAddress' => 'https://www.returnaddress.com'
]);
QrCode::email($to, $subject, $body);
// Fills in the to address
QrCode::email('[email protected]');
// Fills in the to address, subject, and body of an e-mail.
QrCode::email('[email protected]', 'This is the subject.', 'This is the message body.');
// Fills in just the subject and body of an e-mail.
QrCode::email(null, 'This is the subject.', 'This is the message body.');
QrCode::SMS($phoneNumber, $message);
// Creates a text message with the number filled in.
QrCode::SMS('555-555-5555');
// Creates a text message with the number and message filled in.
QrCode::SMS('555-555-5555', 'Body of the message');
QrCode::wiFi([
'encryption' => 'WPA/WEP',
'ssid' => 'SSID of the network',
'password' => 'Password of the network',
'hidden' => 'Whether the network is a hidden SSID or not.'
]);
// Connects to an open WiFi network.
QrCode::wiFi([
'ssid' => 'Network Name',
]);
// Connects to an open, hidden WiFi network.
QrCode::wiFi([
'ssid' => 'Network Name',
'hidden' => 'true'
]);
// Connects to an secured, WiFi network.
QrCode::wiFi([
'ssid' => 'Network Name',
'encryption' => 'WPA',
'password' => 'myPassword'
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.