Coder Social home page Coder Social logo

exqrcode's Introduction

Exqrcode

A php extension generating qrcode ,using libqrencode

install

Requirements

Linux only

php 5.3

libqrencode

(you can see the details of libqrencode on https://github.com/fukuchi/libqrencode)

libpng

this extension has been developmenting now on ubuntu, so the following tips may be helpful for you

1.apt-get install libpng12-0 libpng12-dev

wget http://fukuchi.org/works/qrencode/qrencode-3.3.1.tar.gz

tar -zxvf qrencode-3.3.1.tar.gz

cd qrencode-3.3.1

./configure && make && make install

3.download exqrcode && unzip exqrcode zip file

phpize

./configure --with-qrencode --with-png

make && make install

4.add extension=exqrcode.so into php.ini

retart apache

5.test php

base usage

$instance = new ExQrcode();

$instance->setLevel(ExQrcode::QRLEVEL_H);

$instance->setSize(7);

$instance->setDpi(72);

#encode general text

$instance->encodeGeneral("hello world");

var_dump($instance->writeToFile("/tmp/qrgeneral.png"));

#encode mecard

$arr = array("N" => "name","TEL" => "13900000000","EMAIL" => "email" , "ADDR" => "address" ,"URL" => "http://www.helloworld.com");

$instance->encodeMECard($arr);

var_dump($instance->writeToFile("/tmp/qrmecard.png"));

#encode url

$instance->encodeUrl("http://www.baidu.com");

var_dump($instance->writeToFile("/tmp/qrurl.png"));

#encode phone

$instance->encodePhone("13900000000");

var_dump($instance->writeToFile("/tmp/qrphone.png"));

#encode sms

$instance->encodeSMS("message subject","message content");

var_dump($instance->writeToFile("/tmp/qrsms.png"));

class and interface

class name : ExQrcode

setDpi($dpinumber) default is 72

setSize($size) the dot pixels ,default is 3

setLevel($level) specify error correction level, ExQrcode::QRLEVEL_L,ExQrcode::QRLEVEL_M,ExQrcode::QRLEVEL_Q,ExQrcode::QRLEVEL_H,represent lowest to highest 	

encodeGeneral($text) encode general text

encodeUrl($url) encode a url 

encodeMECard($arr) encode a me card ,parameter is an array,key 'N' means name, 'TEL' means a telphone,'EMAIL' means an email, 'ADDR' menas an address,'URL' means a http url

encodePhone($phonenumber) encode a phonenumber

encodeSMS($smssubject,$content) encode a sms item

encodeICAL(arr) todo

exqrcode's People

Contributors

bingzhenwang avatar

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.