wanadri / x-sign-payload
Secure HMAC-SHA256/SHA512 payload signing and verification for PHP frameworks
v1.0.0
2026-04-30 05:37 UTC
Requires
- php: ^8.1
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.7
README
Secure HMAC-SHA256/SHA512 payload signing and verification for PHP and JavaScript
Features
- 🔐 HMAC-SHA256/SHA512 - Industry-standard cryptographic hashing
- ⏱️ Replay Protection - Configurable timestamp validation
- 🛠️ Multi-Framework - Laravel, CakePHP, CodeIgniter, Node.js, Browser
- ⚡ Easy Integration - Simple middleware and auto-signing
- 🌐 Cross-Language - Sign in JS, verify in PHP (and vice versa)
Quick Start
PHP (Laravel)
composer require wanadri/x-sign-payload php artisan x-sign:install
// routes/api.php Route::post('/webhook', [WebhookController::class, 'handle']) ->middleware('x-sign.verify');
JavaScript (Node.js)
npm install x-sign-payload
import { XSignClient } from "x-sign-payload"; const client = new XSignClient({ secret: process.env.X_SIGN_SECRET, }); const { headers } = client.sign({ user: "john@example.com" }); // headers = { 'X-Signature': 'sha256=...', 'X-Timestamp': '...' }
JavaScript (Browser)
import { XSignClient } from "x-sign-payload"; const client = new XSignClient({ secret: "your-secret" }); const headers = await client.signAsync({ action: "submit" }); fetch("/api/submit", { method: "POST", headers, body: JSON.stringify({ action: "submit" }), });
Documentation
Full documentation is available at: https://wanadri.github.io/x-sign-payload/
Supported Languages & Frameworks
| Language | Framework | Status |
|---|---|---|
| PHP | Laravel 10+ | ✅ Available |
| PHP | CakePHP 4+ | ✅ Available |
| PHP | CodeIgniter 4 | ✅ Available |
| JavaScript | Node.js / Browser | ✅ Available |
| Python | Django / Flask | 🚧 Coming Soon |
| Ruby | Ruby on Rails | 🚧 Coming Soon |
Monorepo Structure
x-sign-payload/
├── packages/
│ ├── php/ # PHP package (wanadri/x-sign-payload)
│ └── js/ # JavaScript package (x-sign-payload)
├── docs/ # VitePress documentation
└── tests/
└── cross-language/ # JS/PHP interoperability tests
Contributing
We welcome contributions! Please see our Contributing Guide.
Support
- ⭐ Star this repository
- 🐛 Report issues
- ☕ Buy me a coffee
License
MIT License - see LICENSE file.
Made with ❤️ by Wan Adri