GithubHelp home page GithubHelp logo

ph-7 / qrcode-generator-php-class Goto Github PK

View Code? Open in Web Editor NEW
98.0 8.0 53.0 48 KB

:rocket: QRCode PHP class (library). QR Code Generator using vCard 4.0 and the Google Chart API

Home Page: http://github.com/pH-7/QRCode-Generator-PHP-Class

License: GNU General Public License v3.0

PHP 100.00%
vcard qrcode-php qr-code generator php qrcode php-qrcode php-qr qrcode-generator

qrcode-generator-php-class's Introduction

๐Ÿš€ PHP QR Code ๐Ÿ“ฑ

Scrutinizer Quality Score

Description

QRCode PHP class allows you to easily generate a simple QR code using vCard 4.0 and the Google Chart API.

Here are two videos explaining QR code: http://www.youtube.com/watch?v=B3lrcOhmp9g and http://www.youtube.com/watch?v=IphTJHiKGos

Composer Installation

You can add it easily in your project by using Composer.

$ composer require ph-7/qrcode-generator-php-class

Then, include Composer's autoload

require_once 'vendor/autoload.php';

Manual Installation

If you don't use Composer, you can install it without Composer by simply including the class

require 'QRCode.class.php';

How to Use

Here's a basic example:

/**
 * If you have PHP 5.4 or higher, you can instantiate the object like this:
 * (new QRCode)->fullName('...')->... // Create vCard Object
 */
$oQRC = new QRCode; // Create vCard Object
$oQRC->fullName('Pierre-Henry Soria') // Add Full Name
    ->nickName('PH7') // Add Nickname
    ->gender('M') // Add Gender
    ->email('[email protected]') // Add Email Address
    ->impp('[email protected]') // Add Instant Messenger
    ->url('http://ph-7.github.com') // Add URL Website
    ->note('Hello to all! I am a web developer. As hobbies I like climbing and swimming ...') // Add Note
    ->categories('developer,designer,climber,swimmer') // Add Categories
    ->photo('http://files.phpclasses.org/picture/user/1122955.jpg') // Add Avatar
    ->lang('en-US') // Add Language
    ->finish(); // End vCard

// echo '<p><img src="' . $oQRC->get(300) . '" alt="QR Code" /></p>'; // Generate and display the QR Code
$oQRC->display(300); // Set size and display QR Code default 150px

You also have a sample file here: http://github.com/pH-7/QRCode-Generator-PHP-Class/blob/master/example.php

Server Requirements

PHP 5.2.4 or higher.

Author

Pierre-Henry Soria

Contact

Contact me at: pierrehenrysoria [[AT]] gmail [[D0T]] com

License

General Public License 3 or later; See the LICENSE.txt file.

qrcode-generator-php-class's People

Contributors

alitelli avatar lynxaegon avatar ph-7 avatar sergiobohrer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qrcode-generator-php-class's Issues

Google API!

Maybe, you should inform all that you are using Google API in your script!

File name is too long and does not work !

this exmp for location url from google map

mysites/qrcode_files/qr-L1-www.google.com.qa_2Fmaps_2Fplace_2F25_25C2_25B017_2727.5_2522N_2B51_25C2_25B032_2748.7_2522E_2F_4025.2922823_2C51.5469781_2C17.44z_2Fdata_3D_214m5_213m4_211s0x0_3A0x0_218m2_213d25.2909722_214d51.5468611_3Fhl_3Den.png

does not work , can you fix it ?

Thanks

URL not working

This is all my code

$url = "https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?";
$cadena = sprintf("%s&id=%s&re=%s&rr=%s&tt=%s&fe=%s", $url, $uuid, $emisor, $receptor, $total, substr($sello, -8));

$oQRC = new QRCode();
$oQRC->url($cadena)->finish();

url test: https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?&id=83DD7B73-B340-44E7-9CC5-BC1F3D20DCBE&re=ASE870213853&rr=MAML9611136T5&tt=4064.79&fe=4xV+yQ==

This is my QR

imagen

The URL is not working, but when I modify this lines

public function __construct() { $this->sData = 'BEGIN:VCARD' . "\n"; $this->sData .= 'VERSION:4.0' . "\n"; }

To

public function __construct() { $this->sData = '' . ""; $this->sData .= '' . ""; }

AND

public function finish() { $this->sData .= 'END:VCARD'; $this->sData = urlencode($this->sData); return $this; }

TO

public function finish() { $this->sData .= ''; $this->sData = urlencode($this->sData); return $this; }

it works

imagen

iOS [ UTF-8 ] problem

Hello my friend
its work as beautiful in Android > 5.0
but it not work in iOS its work but sames have problem with Unicode ...

Can we place logo in center

Hi,

Very easy and understandable library.
We have to place logo in center of QR Code image is it possible if yes please please let me know how? Thank you.

profile image

when I scan the qr code from the example, the image does not show. Any ideas as to where the problem lies?

scanned with an iPhone

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.