PHP code example of kaio-souza / pix-php
1. Go to this page and download the library: Download kaio-souza/pix-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kaio-souza / pix-php example snippets
$pix = new PixGenerator([
MandatoryConfig::PIX_KEY => '[email protected] ',
MandatoryConfig::MERCHANT_NAME => 'Tester',
]);
$pix = new PixGenerator([
'pix_key' => '[email protected] ',
'merchant_name' => 'Tester',
]);
$pix = new PixGenerator([
MandatoryConfig::PIX_KEY => '[email protected] ',
MandatoryConfig::MERCHANT_NAME => 'Tester',
OptionalConfig::MERCHANT_CITY => 'SAO PAULO', // 'SAO PAULO' is the DefaultValue
OptionalConfig::CURRENCY => '986', // 986 = BRL | is the DefaultValue
OptionalConfig::COUNTRY_CODE => 'BR', // 'BR' is the default Alpha2 value
]);
echo $pix->getQrCodeText(20, 'Teste Lala');
// returns [email protected] Lala520400005303986540520,005802BR5906Tester6002BR62270523bca37b925af47abd511393463041FC2
// returns QRCode PNG output
$code = $pix->getQrCode(20, 'Teste Lala');
// Save the output on file
file_put_contents('qr.png', $code);
$code = $pix->getBase64QrCode('14,50', 'Teste Lala');
// show QRCODE on HTML img tag
echo "<img src='data:image/png;base64, {$code}' />";
composer