nowo-tech / redsys-php
Clean-room PHP SDK for the public Redsys TPV Virtual protocol (HMAC signing, redirect, REST). PHP 8.3+ and FrankenPHP worker-safe.
Fund package maintenance!
Requires
- php: >=8.3 <8.6
- ext-curl: *
- ext-json: *
- ext-openssl: *
- psr/log: ^2.0 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- igor-php/igor-php: ^0.9.7 || ^0.10.0
- nowo-tech/phpstan-frankenphp: ^1.1
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
- rector/rector: ^2.0
Suggests
- psr/http-client: Use Http\Psr18HttpClient to send REST calls through your own PSR-18 client
- psr/http-factory: Request / stream factories for Http\Psr18HttpClient
Provides
None
Conflicts
None
Replaces
None
README
⭐ Found this useful? Install from Packagist · Give it a star on GitHub so more developers can find it.
Clean-room PHP SDK for the public Redsys TPV Virtual protocol (HMAC signing, redirect form, REST SIS). Namespace Nowo\Redsys\. License MIT. Release 1.0.10.
This is an independent implementation written from publicly documented algorithms and endpoints. It does not redistribute Redsys proprietary PHPL_* library source. “Redsys” is a trademark of its respective owners.
This bundle is FrankenPHP worker mode friendly.
As a library it is safe in worker mode: RedirectForm returns an HTML string and never calls echo or exit. Audited for worker with kernel not reset — see docs/FRANKENPHP-WORKER-AUDIT.md.
Installation
composer require nowo-tech/redsys-php:^1.0
require_once 'vendor/autoload.php';
Quick start
use Nowo\Redsys\Currency; use Nowo\Redsys\Environment; use Nowo\Redsys\Merchant; use Nowo\Redsys\MerchantParameters; use Nowo\Redsys\RedirectForm; use Nowo\Redsys\SignatureVersion; use Nowo\Redsys\TransactionType; $merchant = new Merchant( merchantCode: '999008881', terminal: '1', secretKey: getenv('REDSYS_SECRET_KEY') ?: '', environment: Environment::Test, signatureVersion: SignatureVersion::HmacSha512V2, ); $params = MerchantParameters::create() ->forMerchant($merchant) ->amount(145) ->order('1444904795') ->currency(Currency::Eur) ->transactionType(TransactionType::Authorization) ->merchantUrl('https://example.test/redsys/notify') ->urlOk('https://example.test/ok') ->urlKo('https://example.test/ko'); $html = RedirectForm::forMerchant($merchant, $params);
Compatibility
PHP 8.3+ with extensions curl, json, openssl.
Develop
make up && make install && make qa make setup-hooks
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
- Sandbox: test credentials and cards
- PSR evaluation (REQ-CS-007)
- Coverage
- GitHub CI
- Branching
- FrankenPHP demo
- FrankenPHP worker audit
Tests and coverage
composer install
composer test
composer test-coverage
PHP: 100% lines (278/278; Clover gate ≥ 99%, see docs/COVERAGE.md). TS/JS: N/A. Python: N/A.
make qa make release-check
License
MIT — see LICENSE.
Independent clean-room implementation of the public Redsys TPV Virtual protocol. Does not redistribute Redsys proprietary PHPL_* source. “Redsys” is a trademark of its respective owners.
