Files
php-qrcode/Usage/Quickstart.html

445 lines
38 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Quickstart &mdash; PHP-QRCode main
Manual</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=9edc463e" />
<script src="../_static/jquery.js?v=5d32c60e"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../_static/documentation_options.js?v=a8da1a53"></script>
<script src="../_static/doctools.js?v=fd6eb6e6"></script>
<script src="../_static/sphinx_highlight.js?v=6ffebe34"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Advanced usage" href="Advanced-usage.html" />
<link rel="prev" title="Installation" href="Installation.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home">
PHP-QRCode
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Usage</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="Overview.html">Overview</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Overview.html#features">Features</a></li>
<li class="toctree-l2"><a class="reference internal" href="Overview.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="Overview.html#framework-integration">Framework Integration</a></li>
<li class="toctree-l2"><a class="reference internal" href="Overview.html#shameless-advertising">Shameless advertising</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Installation.html">Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Installation.html#installation-with-composer">Installation with Composer</a><ul>
<li class="toctree-l3"><a class="reference internal" href="Installation.html#composer-json">composer.json</a><ul>
<li class="toctree-l4"><a class="reference internal" href="Installation.html#version-switch">Version switch</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="Installation.html#terminal">Terminal</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Installation.html#manual-installation">Manual installation</a><ul>
<li class="toctree-l3"><a class="reference internal" href="Installation.html#can-i-use-this-library-without-using-composer">Can I use this library without using composer?</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Installation.html#supported-php-versions-extension-requirements">Supported PHP versions &amp; extension requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="Installation.html#imagemagick">ImageMagick</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Quickstart</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#import-the-library">Import the library</a></li>
<li class="toctree-l2"><a class="reference internal" href="#create-your-first-qr-code">Create your first QR Code</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#configuration">Configuration</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#notes">Notes</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Advanced-usage.html">Advanced usage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Advanced-usage.html#configuration-via-qroptions">Configuration via <code class="docutils literal notranslate"><span class="pre">QROptions</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#supply-an-iterable-of-options">Supply an <code class="docutils literal notranslate"><span class="pre">iterable</span></code> of options</a></li>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#load-and-save-options-from-to-json">Load and save options from/to JSON</a></li>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#extending-the-qroptions-class">Extending the <code class="docutils literal notranslate"><span class="pre">QROptions</span></code> class</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Advanced-usage.html#qrcode-methods"><code class="docutils literal notranslate"><span class="pre">QRCode</span></code> methods</a><ul>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#render-a-qrmatrix-instance">Render a <code class="docutils literal notranslate"><span class="pre">QRMatrix</span></code> instance</a></li>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#mixed-mode">Mixed mode</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Advanced-usage.html#common-output-options">Common output options</a><ul>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#save-to-file">Save to file</a></li>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#base64-uri-output">Base64 URI output</a></li>
<li class="toctree-l3"><a class="reference internal" href="Advanced-usage.html#return-the-image-resource">Return the image resource</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Configuration-settings.html">Configuration settings</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#version">version</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#versionmin">versionMin</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#versionmax">versionMax</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#ecclevel">eccLevel</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#maskpattern">maskPattern</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#addquietzone">addQuietzone</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#quietzonesize">quietzoneSize</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#outputinterface">outputInterface</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#returnresource">returnResource</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#cachefile">cachefile</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#outputbase64">outputBase64</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#eol">eol</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#bgcolor">bgColor</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#invertmatrix">invertMatrix</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#drawlightmodules">drawLightModules</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#drawcircularmodules">drawCircularModules</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#circleradius">circleRadius</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#keepassquare">keepAsSquare</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#connectpaths">connectPaths</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#excludefromconnect">excludeFromConnect</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#modulevalues">moduleValues</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#addlogospace">addLogoSpace</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#logospacewidth">logoSpaceWidth</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#logospaceheight">logoSpaceHeight</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#logospacestartx">logoSpaceStartX</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#logospacestarty">logoSpaceStartY</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#scale">scale</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#imagetransparent">imageTransparent</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#transparencycolor">transparencyColor</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#quality">quality</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#gdimageuseupscale">gdImageUseUpscale</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#imagickformat">imagickFormat</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#cssclass">cssClass</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#svgaddxmlheader">svgAddXmlHeader</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#svgdefs">svgDefs</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#svgpreserveaspectratio">svgPreserveAspectRatio</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#svgusefillattributes">svgUseFillAttributes</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#textlinestart">textLineStart</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#jsonflags">jsonFlags</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#fpdfmeasureunit">fpdfMeasureUnit</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#xmlstylesheet">xmlStylesheet</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#readeruseimagickifavailable">readerUseImagickIfAvailable</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#readergrayscale">readerGrayscale</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#readerinvertcolors">readerInvertColors</a></li>
<li class="toctree-l2"><a class="reference internal" href="Configuration-settings.html#readerincreasecontrast">readerIncreaseContrast</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Reading-QRCodes.html">Reading QR Codes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Reading-QRCodes.html#basic-usage">Basic usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="Reading-QRCodes.html#the-luminancesourceinterface">The <code class="docutils literal notranslate"><span class="pre">LuminanceSourceInterface</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="Reading-QRCodes.html#the-decoder">The <code class="docutils literal notranslate"><span class="pre">Decoder</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="Reading-QRCodes.html#general-considerations">General considerations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Logos.html">Logos and logo space</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Logos.html#info">Info</a></li>
<li class="toctree-l2"><a class="reference internal" href="Logos.html#adding-a-logo-space">Adding a logo space</a></li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Customizing output</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Customizing/Module-Values.html">Module values</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Module-Values.html#basics">Basics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Module-Values.html#assigning-values">Assigning values</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Module-Values.html#handling-in-your-own-qroutputinterface">Handling in your own <code class="docutils literal notranslate"><span class="pre">QROutputInterface</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/Module-Values.html#setting-module-values">Setting module values</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/Module-Values.html#using-the-module-values">Using the module values</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Customizing/QROutputAbstract.html"><code class="docutils literal notranslate"><span class="pre">QROutputAbstract</span></code></a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/QROutputAbstract.html#properties">Properties</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#options-and-matrix"><code class="docutils literal notranslate"><span class="pre">$options</span></code> and <code class="docutils literal notranslate"><span class="pre">$matrix</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#modulecount-scale-and-length"><code class="docutils literal notranslate"><span class="pre">$moduleCount</span></code>, <code class="docutils literal notranslate"><span class="pre">$scale</span></code> and <code class="docutils literal notranslate"><span class="pre">$length</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#modulevalues"><code class="docutils literal notranslate"><span class="pre">$moduleValues</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#copies-of-qroptions-values">Copies of <code class="docutils literal notranslate"><span class="pre">QROptions</span></code> values</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/QROutputAbstract.html#methods">Methods</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#setmodulevalues"><code class="docutils literal notranslate"><span class="pre">setModuleValues()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#modulevalueisvalid"><code class="docutils literal notranslate"><span class="pre">moduleValueIsValid()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#preparemodulevalue"><code class="docutils literal notranslate"><span class="pre">prepareModuleValue()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#getdefaultmodulevalue"><code class="docutils literal notranslate"><span class="pre">getDefaultModuleValue()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#getmodulevalue-and-getmodulevalueat"><code class="docutils literal notranslate"><span class="pre">getModuleValue()</span></code> and <code class="docutils literal notranslate"><span class="pre">getModuleValueAt()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#setmatrixdimensions"><code class="docutils literal notranslate"><span class="pre">setMatrixDimensions()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#getoutputdimensions"><code class="docutils literal notranslate"><span class="pre">getOutputDimensions()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#collectmodules"><code class="docutils literal notranslate"><span class="pre">collectModules()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../Customizing/QROutputAbstract.html#savetofile-and-tobase64datauri"><code class="docutils literal notranslate"><span class="pre">saveToFile()</span></code> and <code class="docutils literal notranslate"><span class="pre">toBase64DataURI()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Customizing/Custom-output-interface.html">Custom <code class="docutils literal notranslate"><span class="pre">QROutputInterface</span></code></a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Custom-output-interface.html#class-skeleton">Class skeleton</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Custom-output-interface.html#module-values">Module values</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Custom-output-interface.html#transform-the-output">Transform the output</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Custom-output-interface.html#run-the-custom-output">Run the custom output</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Customizing/Custom-output-interface.html#summary">Summary</a></li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Built-In Output Classes</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QREps.html">QREps</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QREps.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QREps.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QREps.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRFpdf.html">QRFpdf</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRFpdf.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRFpdf.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRFpdf.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRGdImage.html">QRGdImage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRGdImage.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRGdImage.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRGdImage.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRImagick.html">QRImagick</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRImagick.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRImagick.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRImagick.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRInterventionImage.html">QRInterventionImage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRInterventionImage.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRInterventionImage.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRInterventionImage.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRMarkupHTML.html">QRMarkupHTML</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupHTML.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupHTML.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupHTML.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRMarkupSVG.html">QRMarkupSVG</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupSVG.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupSVG.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupSVG.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRMarkupXML.html">QRMarkupXML</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupXML.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupXML.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRMarkupXML.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRStringJSON.html">QRStringJSON</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRStringJSON.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRStringJSON.html#previous-functionality">Previous functionality</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRStringJSON.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRStringJSON.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Built-In-Output/QRStringText.html">QRStringText</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRStringText.html#example">Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRStringText.html#additional-methods">Additional methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Built-In-Output/QRStringText.html#options-that-affect-this-class">Options that affect this class</a></li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Appendix</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Appendix/Terminology.html">Terminology</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#qr-code">QR Code</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#matrix">Matrix</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#module">Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#version">Version</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#function-patterns">Function Patterns</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#finder-pattern">Finder Pattern</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#alignment-pattern">Alignment Pattern</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#timing-pattern">Timing Pattern</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#separators">Separators</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#quiet-zone">Quiet Zone</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#encoding-region">Encoding Region</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#data">Data</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#version-information">Version Information</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#format-information">Format Information</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#darkmodule">Darkmodule</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#mode">Mode</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#segment">Segment</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#extended-channel-interpretation-eci">Extended Channel Interpretation (ECI)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#mixed-mode">Mixed Mode</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#ecc-error-correction-coding">ECC (Error Correction Coding)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#ecc-level">ECC Level</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#maximum-data-capacity">Maximum data capacity</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#data-masking">Data masking</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#evaluation">Evaluation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/Terminology.html#mask-pattern">Mask pattern</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Terminology.html#reflectance">Reflectance</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Appendix/URI-Content.html">Popular content and URI schemes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#url-https">URL <code class="docutils literal notranslate"><span class="pre">https</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#e-mail-mailto">E-Mail <code class="docutils literal notranslate"><span class="pre">mailto</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#phone-numbers-tel">Phone numbers <code class="docutils literal notranslate"><span class="pre">tel</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#geo-coordinates-geo">Geo Coordinates <code class="docutils literal notranslate"><span class="pre">geo</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#mobile-authenticators-otpauth">Mobile Authenticators <code class="docutils literal notranslate"><span class="pre">otpauth</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#wireless-network-configuration">Wireless Network configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#contact-information-vcard">Contact information: vCard</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#calendar-events-vcalendar-and-icalendar">Calendar Events: vCalendar and iCalendar</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#credit-transfer">Credit Transfer</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/URI-Content.html#sepa-european-payments-council">SEPA (European Payments Council)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../Appendix/URI-Content.html#pix-banco-central-do-brasil">Pix (Banco Central do Brasil)</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/URI-Content.html#see-also">See also</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Appendix/Performance-considerations.html">Performance considerations</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Performance-considerations.html#version">Version</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Performance-considerations.html#ecc-level">Ecc level</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Performance-considerations.html#data-mode">Data mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Performance-considerations.html#mask-pattern">Mask pattern</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Performance-considerations.html#output">Output</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Appendix/Contribute.html">How to contribute</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Contribute.html#questions-and-issues">Questions and issues</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Contribute.html#bug-reports">Bug reports</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Contribute.html#pull-requests-and-bug-fixes">Pull requests and bug fixes</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Appendix/Contribute.html#documentation">Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../Appendix/License.html">License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">PHP-QRCode</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Quickstart</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/chillerlan/php-qrcode/blob/main/docs/Usage/Quickstart.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="quickstart">
<h1>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h1>
<section id="import-the-library">
<h2>Import the library<a class="headerlink" href="#import-the-library" title="Link to this heading"></a></h2>
<p>Import the main class(es) and include the autoloader (if necessary):</p>
<div class="highlight-php notranslate"><div class="highlight"><pre><span></span><span class="k">use</span> <span class="nx">chillerlan\QRCode\</span><span class="p">{</span><span class="nx">QRCode</span><span class="p">,</span> <span class="nx">QROptions</span><span class="p">};</span>
<span class="k">require_once</span> <span class="no">__DIR__</span><span class="o">.</span><span class="s1">&#39;/../vendor/autoload.php&#39;</span><span class="p">;</span>
</pre></div>
</div>
</section>
<section id="create-your-first-qr-code">
<h2>Create your first QR Code<a class="headerlink" href="#create-your-first-qr-code" title="Link to this heading"></a></h2>
<p>We want to encode this URI for a mobile authenticator into a QRcode image:</p>
<div class="highlight-php notranslate"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="s1">&#39;otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&amp;issuer=chillerlan.net&#39;</span><span class="p">;</span>
<span class="nv">$qrcode</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">QRCode</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">render</span><span class="p">(</span><span class="nv">$data</span><span class="p">);</span>
<span class="c1">// default output is a base64 encoded data URI</span>
<span class="nb">printf</span><span class="p">(</span><span class="s1">&#39;&lt;img src=&quot;%s&quot; alt=&quot;QR Code&quot; /&gt;&#39;</span><span class="p">,</span> <span class="nv">$qrcode</span><span class="p">);</span>
</pre></div>
</div>
<section id="configuration">
<h3>Configuration<a class="headerlink" href="#configuration" title="Link to this heading"></a></h3>
<p>Configuration using <code class="docutils literal notranslate"><span class="pre">QROptions</span></code>:</p>
<div class="highlight-php notranslate"><div class="highlight"><pre><span></span><span class="nv">$options</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">QROptions</span><span class="p">;</span>
<span class="nv">$options</span><span class="o">-&gt;</span><span class="na">version</span> <span class="o">=</span> <span class="mi">7</span><span class="p">;</span>
<span class="nv">$options</span><span class="o">-&gt;</span><span class="na">outputBase64</span> <span class="o">=</span> <span class="k">false</span><span class="p">;</span> <span class="c1">// output raw image instead of base64 data URI</span>
<span class="nb">header</span><span class="p">(</span><span class="s1">&#39;Content-type: image/svg+xml&#39;</span><span class="p">);</span> <span class="c1">// the image type is SVG by default</span>
<span class="k">echo</span> <span class="k">new</span> <span class="nx">QRCode</span><span class="p">(</span><span class="nv">$options</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">render</span><span class="p">(</span><span class="nv">$data</span><span class="p">);</span>
</pre></div>
</div>
<p>See <a class="reference internal" href="Advanced-usage.html"><span class="std std-doc">Advanced usage</span></a> for a more in-depth usage guide
and <a class="reference internal" href="Configuration-settings.html"><span class="std std-doc">configuration settings</span></a> for a list of available options.
Also, have a look <a class="reference external" href="https://github.com/chillerlan/php-qrcode/tree/main/examples">in the examples folder</a> for some more usage examples.</p>
</section>
</section>
<section id="notes">
<h2>Notes<a class="headerlink" href="#notes" title="Link to this heading"></a></h2>
<p>The QR encoder, especially the subroutines for mask pattern testing, can cause high CPU load on increased matrix size.
You can avoid a part of this load by choosing a fast output module, like SVG.
Oh hey and dont forget to sanitize any user input!</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="Installation.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="Advanced-usage.html" class="btn btn-neutral float-right" title="Advanced usage" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2026, smiley.</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>