Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A PHP QR Code generator and reader with a user-friendly API.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-ASL-2.0
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

chillerlan/php-qrcode

Repository files navigation

A PHP QR Code generator based on theimplementation by Kazuhiko Arase, namespaced, cleaned up, improved and other stuff.
It also features a QR Code reader based on aPHP port of theZXing library.

Attention: there is now also a javascript port on NPM:@chillerlan/qrcode.

PHP Version SupportPackagist versionContinuous IntegrationCodeCovCodacyPackagist downloadsDocumentation

Overview

Features

  • Creation ofModel 2 QR Codes,Version 1 to 40
  • ECC Levels L/M/Q/H supported
  • Mixed mode support (encoding modes can be combined within a QR symbol). Supported modes:
  • Flexible, easily extensible output modules, built-in support for the following output formats:
  • QR Code reader (via GD and ImageMagick)

Requirements

For the QR Code reader, eitherext-gd orext-imagick is required!

Documentation

Important: Please use the examples from the branch that matches your installed php-qrcode version (v4.x,v5.x,dev-main)!

Installation withcomposer

Seethe installation guide for more info!

Terminal

composer require chillerlan/php-qrcode

composer.json

{"require": {"php":"^8.2","chillerlan/php-qrcode":"dev-main#<commit_hash>"}}

Note: replacedev-main with aversion constraint, e.g.^5.0 - seereleases for valid versions.

Quickstart

We want to encode this URI for a mobile authenticator into a QRcode image:

$data ='otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net';// quick and simple:echo'<img src="'.(newQRCode)->render($data).'" alt="QR Code" />';

Wait, what was that? Please again, slower! SeeAdvanced usage in the manual.Also, have a lookin the examples folder for some more usage examples.

QR codes are awesome!

Reading QR Codes

Using the built-in QR Code reader is pretty straight-forward:

// it's generally a good idea to wrap the reader in a try/catch block because it WILL throw eventuallytry{$result = (newQRCode)->readFromFile('path/to/file.png');// -> DecoderResult// you can now use the result instance...$content =$result->data;$matrix  =$result->getMatrix();// -> QRMatrix// ...or simply cast it to string to get the content:$content = (string)$result;}catch(Throwable$e){// oopsies!}

Shameless advertising

Hi, please check out some of my other projects that are way cooler than qrcodes!

Disclaimer!

I don't take responsibility for molten CPUs, misled applications, failed log-ins etc.. Use at your own risk!

License notice

Trademark Notice

The word "QR Code" is a registered trademark ofDENSO WAVE INCORPORATED
https://www.qrcode.com/en/faq.html#patentH2Title


[8]ページ先頭

©2009-2025 Movatter.jp