New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

vcode/qrcode

This is package generate Qrcode using some services like google qrcode. This package also support attaching logo into qrcode. In Laravel framework, it fully support for using facade, blade helper.
465 4
Install
composer require vcode/qrcode
Latest Version:v1.1.0
PHP:>=5.3.0
Older releases:4 · 5
License:MIT
Last Updated:Jul 11, 2017
Links: GitHub  ·  Packagist
Maintainer: tyanhly

PHP Qrcode Library (support laravel framework)


Introduction

This is package generate Qrcode using some services like google qrcode (currently, it only support google service). This package also support attaching logo into qrcode. In Laravel framework, it fully support for using facade, blade helper.

Reference https://developers.google.com/chart/infographics/docs/qr_code

Installation

  • This is require: php5-gd for write image.
      Debian: apt-get install php5-gd

      RedHat: yum install gd gd-devel php-gd
  • Update require in composer.json file.
      "vcode/qrcode": "dev-master"
  • You'll then need to run
      composer update
  • Or
      composer require "vcode/qrcode":"dev-master"

LARAVEL USING

File: app/config/app.php

Provider:


    'providers' => array(
        'Vcode\Qrcode\QrcodeServiceProvider',
    )

Facade


    'aliases' => array(
        'Qrcode' => 'Vcode\Qrcode\Facades\Qrcode',
    )
    

Create configuration file using artisan

$ php artisan config:publish vcode/qrcode
Using In Controller

    $value = "https://github.com/tyanhly/vcode_qrcode";

    //or for fully options
    //$value = array(
    //    'chs' => "250x250",
    //    'cht' => "qr",
    //    'chl' => "https://github.com/tyanhly/vcode_qrcode"
    //    'chld'=> "H|1",         // H(QML)|1, H|2, H|3, H|4, H|10, H|40,
    //    'choe'=> "UTF-8"        // UTF-8, Shift_JIS, ISO-8859-1
    //);
    
    /**
     * @param array googleOption
     * @param string $destinate
     * @param string $logoPath
     * @param float $ratioOfLogoOnQrcode
     * @param int $qrCodeService
     */
    //Qrcode::storageImage(array googleOption, string $destinate, string $logoPath, float $ratioOfLogoOnQrcode, int $qrCodeService);
    Qrcode::storageImage($value, "/tmp/destination.png", "logo.png", 0.3);
    
    
    /**
     * @param array googleOption
     * @param int $qrCodeService
     */
    //Qrcode::render(array googleOption, int $qrCodeService);
    Qrcode::render($value);
    
    /**
     * @param array googleOption
     * @param string $logoPath
     * @param float $ratioOfLogoOnQrcode
     * @param int $qrCodeService
     */
    //Qrcode::renderBase64(array googleOption, string $logoPath, float $ratioOfLogoOnQrcode, int $qrCodeService);
    Qrcode::renderBase64($value, "logo.png");
    
    
    /**
     * @param array googleOption
     * @param string $logoPath
     * @param float $ratioOfLogoOnQrcode
     * @param int $qrCodeService
     */
    //Qrcode::renderBase64Dome(array googleOption, string $logoPath, float $ratioOfLogoOnQrcode, int $qrCodeService);
    Qrcode::renderBase64Dom($value, "logo.png");

Using the Blade helper

@qrcode("https://github.com/tyanhly/vcode_qrcode")
@qrcodeBase64Dom("https://github.com/tyanhly/vcode_qrcode", "logo.png", 0.5)
<img src="data:image/png;base64,@qrcodeBase64("https://github.com/tyanhly/vcode_qrcode", "logo.png", 0.5)" />

Using like php library


    //Please, reference <this source>/example for more detail
    
    include 'vendor/autoload.php';
    $qrcode = new Vcode\Qrcode\Qrcode(array(
            'qrcode::google_config_default' => array(
                'chs' => "250x250",
                'cht' => "qr",
                'chld'=> "H|1",         // H(QML)|1, H|2, H|3, H|4, H|10, H|40,
                'choe'=> "UTF-8"        // UTF-8, Shift_JIS, ISO-8859-1
            ),
            'qrcode::template_simple' => './template',
            'qrcode::storage_dir'     => '/tmp'
        ));
    $value = "MECARD:N:XXXXX;ADR:xxx xxxxx xxxxxx xx xxx city;"
           . "TEL:+XXXXXXXXX;EMAIL:xxxxx@gmail.com;;";
    //$qrcode->render($value);
    $qrcode->renderBase64Dom($value, "logo.png", 0.7);
    

Example

Change Log

v1.0.0
  • First release
v1.0.1
  • Base64 encoding
  • Storage image
v1.1.0
  • Logo attach
  • Support like a library, not only for laravel.

Related Packages

valorin/random

Random is a simple helper package designed to make it easy to generate a range o...

413,065 233
php
robbiep/zbar-qrdecoder

A PHP wrapper for Zbar. Decodes images/photos containing QR codes.

54,129 33
cline/variable-keys

Laravel Blueprint macros for variable primary key and morph types

22,912 0
php
cline/struct

Lean, attribute-driven Laravel data objects with explicit validation and Eloquen...

17,788 0
php
cline/toggl

Advanced feature flag management with strategies, time bombs, and groups

12,171 0
php

Version History

Version Released PHP Laravel License
v1.1.0 >=5.3.0 MIT
v1.0.0 >=5.3.0 >=4.1.1 MIT