PHPackages                             hrmpfz/pay-by-square - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. hrmpfz/pay-by-square

ActiveLibrary[Payment Processing](/categories/payments)

hrmpfz/pay-by-square
====================

Pure PHP PAY by square payment QR payload generator without external dependencies or shell commands.

v1.0.1(1mo ago)12.9k↑1183.3%Apache-2.0PHPPHP &gt;=8.1

Since Jul 5Pushed 1mo agoCompare

[ Source](https://github.com/hrmpfz/pay-by-square)[ Packagist](https://packagist.org/packages/hrmpfz/pay-by-square)[ RSS](/packages/hrmpfz-pay-by-square/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

pure-PHP PAY by square QR Payload Generator
===========================================

[](#pure-php-pay-by-square-qr-payload-generator)

A lightweight, Composer-compatible PHP library to generate Slovak **PAY by square** payment QR code payloads.

### Why this library?

[](#why-this-library)

Most existing PHP libraries for PAY by square depend on the external `xz` system binary or PECL extensions to perform the LZMA compression required by the standard. This makes them incompatible with cheap, shared, FTP-only hosting where shell execution functions (`exec`, `shell_exec`, `proc_open`) and custom C extensions are disabled.

This library features a **100% pure-PHP implementation of the LZMA range encoder**, requiring zero external binaries or system extensions beyond common PHP core features.

---

Features
--------

[](#features)

- **Zero dependencies on external binaries** (no `xz`, `7z` or similar CLI tools needed).
- **Safe for shared FTP hosting**: Does not use `exec`, `proc_open`, FFI, or PECL extensions.
- **Fluent Payment Data API** (IBAN, BIC, amount, variable symbol, constant symbol, specific symbol, payment note/message, due date, beneficiary details).
- **Automatic deburring**: Removes Slovak diacritics automatically to ensure compatibility with older banking apps.
- **QR Code generation**: Simple rendering to SVG or PNG out-of-the-box using `chillerlan/php-qrcode`.

---

Installation
------------

[](#installation)

Add the library to your project using Composer:

```
composer require "hrmpfz/pay-by-square"
```

---

Usage
-----

[](#usage)

```
use Hrmpfz\PayBySquare\Payment;
use Hrmpfz\PayBySquare\PayBySquare;

// 1. Create and configure your payment order
$payment = Payment::create()
    ->iban('SK0000000000000000000000')
    ->bic('BANKSKBX')
    ->amount('49.00')
    ->currency('EUR')
    ->variableSymbol('202600123')
    ->message('Registracny poplatok')
    ->dueDate(new DateTimeImmutable('2026-07-13'));

// 2. Generate the raw PAY by square payload (Base32Hex format)
$payload = PayBySquare::encode($payment);
echo "PAY by square string: " . $payload . "\n";

// 3. Render directly to files
// Render SVG QR code:
PayBySquare::svg($payment, __DIR__ . '/payment.svg');

// Render PNG QR code (requires the PHP GD extension):
PayBySquare::png($payment, __DIR__ . '/payment.png');
```

---

FTP Shared Hosting Deployment
-----------------------------

[](#ftp-shared-hosting-deployment)

To deploy this library to shared hosting:

1. Install it locally or in your CI/CD pipeline using Composer: ```
    composer install --no-dev
    ```
2. Upload the entire project directory including the `vendor/` folder to your shared FTP hosting.
3. Call the library in your code as shown above. No special configuration or system-level setups are required!

---

How It Works Under the Hood
---------------------------

[](#how-it-works-under-the-hood)

The PAY by square standard adopts the LZMA1 compression format (with parameters `lc=3`, `lp=0`, `pb=2`). To keep the PHP library simple and avoid porting the complex LZ77 match-finding algorithms of the LZMA SDK, this library implements a **literal-only LZMA range encoder**:

1. All characters are encoded as literal symbols within the LZMA range coder.
2. The resulting compressed stream is only about ~14 bytes larger than one compressed with match-finding, meaning a typical invoice payload compresses to ~105 bytes.
3. This is well within the QR code capacity limits (max 550 characters) and is 100% compliant with standard decoders used by Slovak banks.

---

Credits
-------

[](#credits)

This library was completely designed and generated by **Antigravity**, an agentic AI coding assistant by Google DeepMind.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

48d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/560489?v=4)[dmagician](/maintainers/dmagician)[@dmagician](https://github.com/dmagician)

---

Top Contributors

[![dmagician](https://avatars.githubusercontent.com/u/560489?v=4)](https://github.com/dmagician "dmagician (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hrmpfz-pay-by-square/health.svg)

```
[![Health](https://phpackages.com/badges/hrmpfz-pay-by-square/health.svg)](https://phpackages.com/packages/hrmpfz-pay-by-square)
```

###  Alternatives

[appwrite/server-ce

End to end backend server for frontend and mobile apps.

56.9k115.4k](/packages/appwrite-server-ce)[filament/filament

A collection of full-stack components for accelerated Laravel app development.

3932.5M4.4k](/packages/filament-filament)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

630386.5k2](/packages/eduardokum-laravel-boleto)[openboleto/openboleto

Biblioteca para geração de boletos bancários.

611231.9k1](/packages/openboleto-openboleto)[piggly/php-pix

Uma biblioteca para preparar e gerar o código Pix do Banco Central do Brasil.

108161.6k1](/packages/piggly-php-pix)[abydahana/aksara

Aksara is a modern, developer-friendly framework and CMS built on CodeIgniter 4, featuring rapid CRUD development, modular architecture, smart routing, flexible access control, API integration, and an AI assistant to make content management faster and smarter.

1141.2k](/packages/abydahana-aksara)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
