PHP com duas funções: uma para gerar a linha do Pix Copia e Cola e outra para gerar o QRCode baseado no retorno da primeira função.

Overview

pix-copiacola-qrcode

Pix.php - Funções para gerar, de forma simples, a linha "Copia e Cola" e o QRCode

Necessita PHP 7 ou superior

Para o QRCode usa as bibliotecas do "chillerlan/php-qrcode", siga as instruções em https://github.com/chillerlan/php-qrcode e https://chillerlan.github.io/php-qrcode/

Na subpasta "qrcode" foram copiados do repositório acima (versão em 11/2021) e mantidos apenas os arquivos essenciais

Para a documentação do BC para o Pix, acesse: https://www.bcb.gov.br/content/estabilidadefinanceira/spb_docs/ManualBRCode.pdf

Função GeraCopiaCola(): recebe os campos e gera a linha usada no Copia e Cola e para gerar posteriormente o QRCode

Parâmetros obrigatórios:

  • $Chave: chave Pix, podendo ser email, chave aleatória, celular (apenas números) ou cpf/cnpj (apenas números)
  • $Valor: valor já no formato internacional, com ponto para decimais e sem separador de milhar, ex: 234.50
  • $Beneficiario: nome do titular atrelado a chave Pix, até 25 posições e sem acentos
  • $Cidade: cidade do titular atrelado a chave Pix, até 15 posições e sem acentos
  • $Identificador: identificador até 25 posições, sem espaços e sem acentos, apenas letras e números

Função GeraQRCode(): recebe a linha gerada no Copia e Cola e transforma em QRCode, retornando a imagem em Base64 para dar "echo" direto no "src" da tag html "img"

Parâmetros obrigatórios:

  • $S: string gerada pela função GeraCopiaCola()

Veja o arquivo "exemplo.php" para um exemplo funcional

Desenvolvido por Rogério Vitiello - www.arvy.com.br


Se meu código ajudou você de alguma forma, poderia me pagar o cafezinho de 5 reais que está no exemplo.php, né? :)

qr

You might also like...
A BPMN 2.0 workflow engine for PHP

Workflower A BPMN 2.0 workflow engine for PHP Workflower is a BPMN 2.0 workflow engine for PHP. Workflower runs business processes using the BPMN 2.0

A Sharex IMG uploader that runs with PHP | Use a hosting site if you're a beginner use 000webhost
A Sharex IMG uploader that runs with PHP | Use a hosting site if you're a beginner use 000webhost

Sharex-Img-Uploader A Sharex IMG uploader that runs with PHP | Use a hosting site if you're a beginner use 000webhost Setting up SXCU In YOUR_DOMAIN_U

A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API.
A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API.

A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API. This enables you to build cool little tricks, like showing your latest followers or sponsors, latest content creted, a qrcode to something, a progress bar for some goal, and whathever you can think of.

php-gd based image templates
php-gd based image templates

gdaisy A highly experimental image templating system based on PHP-GD to dynamically generate image banners and covers. Installation 1. Require erikahe

Instagram with ImageMagick & PHP
Instagram with ImageMagick & PHP

Instagraph - Instagram with ImageMagick & PHP In this repository, I’ll demonstrate you how to create vintage (just like Instagram does) photos effects

Grabs the dominant color or a representative color palette from an image. Uses PHP and GD, Imagick or Gmagick.

Color Thief PHP A PHP class for grabbing the color palette from an image. Uses PHP and GD or Imagick libraries to make it happen. It's a PHP port of t

Get started with the Microsoft Graph SDK for PHP

If you want to play around with the PHP library, you can get up and running quickly with the PHP Connect Sample. This sample will start you with a little Laravel project that helps you with registration, authentication, and making a simple call to the service.

This is a simpler way to decode the Green Pass QR-code in your PHP application.
This is a class of php QR Code, This library helps you generate QR codes in a jiffy.

This is a class of php QR Code, This library helps you generate QR codes in a jiffy.

Owner
Rogerio Arvy Vitiello
Rogerio Arvy Vitiello
An easy-to-use PHP QrCode generator with first-party support for Laravel.

An easy-to-use PHP QrCode generator with first-party support for Laravel.

Simple Software LLC 2.2k Jan 5, 2023
Conectores para resolver captchas de imágenes

phpcfdi/image-captcha-resolver Conectores para resolver captchas de imágenes ???? The documentation of this project is in spanish as this is the natur

phpCfdi 7 Nov 17, 2022
PHP Exif Library - library for reading and writing Exif headers in JPEG and TIFF files using PHP.

PEL: PHP Exif Library README file for PEL: PHP Exif Library. A library with support for reading and writing Exif headers in JPEG and TIFF images using

null 264 Dec 4, 2022
PHP Image Manipulation

Intervention Image Intervention Image is a PHP image handling and manipulation library providing an easier and expressive way to create, edit, and com

null 13k Jan 3, 2023
PHP 5.3 Object Oriented image manipulation library

Imagine Tweet about it using the #php_imagine hashtag. Image manipulation library for PHP 5.3 inspired by Python's PIL and other image libraries. Requ

Bulat Shakirzyanov 4.3k Jan 6, 2023
🌄 Perceptual image hashing for PHP

ImageHash A perceptual hash is a fingerprint of a multimedia file derived from various features from its content. Unlike cryptographic hash functions

Jens Segers 1.9k Dec 28, 2022
GifCreator is a PHP class that creates animated GIF from multiple images

================================ GifCreator ================================ GifCreator is a PHP class to create animated GIF from multiple images For

Clément Guillemain 320 Dec 15, 2022
GifFrameExtractor is a PHP class that separates all the frames (and their duration) of an animated GIF

================================ GifFrameExtractor ================================ GifFrameExtractor is a PHP class that separates all the frames (an

Clément Guillemain 173 Dec 12, 2022
Image Cache is a very simple PHP class that accepts an image source and will compress and cache the file, move it to a new directory, and returns the new source for the image.

NO LONGER MAINTAINED!!! Image Cache v. 1.0.0 Image Cache is a very simple PHP class that accepts an image source and will compress and cache the file,

Erik Nielsen 455 Dec 30, 2022
PHP Captcha library

Captcha Installation With composer : { ... "require": { "gregwar/captcha": "1.*" } } Usage You can create a captcha with the Captc

Grégoire Passault 1.6k Dec 25, 2022