mitoop/laravel-signature-sdk

There is no license information available for the latest version (v1.0.0) of this package.

v1.0.0 2025-04-27 08:20 UTC

This package is auto-updated.

Last update: 2025-04-28 14:57:01 UTC


README

SDK for Laravel Signature

Requirements

  • PHP 7.4 or higher

Installation

To install the Laravel Signature SDK, run the following command:

composer require mitoop/laravel-signature-sdk

🚀 Quick Start

Using RSA Signature:

use Mitoop\LaravelSignatureSdk\RsaSigner;
use Mitoop\LaravelSignatureSdk\RequestSigner;

$privateKey = 'your_private_key_string_without_BEGIN/END';
$signer = new RsaSigner($privateKey);

$requestSigner = new RequestSigner(
    mchid: 'your_merchant_id',
    appid: 'your_app_id',
    signer: $signer,
    platformPrefix: 'XXX' // Platform prefix
);

$authorization = $requestSigner->generateAuthorization(
    method: 'POST',
    url: 'https://api.example.com/v1/pay',
    data: [
        'amount' => 100,
        'currency' => 'USD'
    ]
);

Using HMAC Signature:

use Mitoop\LaravelSignatureSdk\HmacSigner;
use Mitoop\LaravelSignatureSdk\RequestSigner;

$secretKey = 'your_hmac_secret_key';
$signer = new HmacSigner($secretKey);

$requestSigner = new RequestSigner(
    mchid: 'your_merchant_id',
    appid: 'your_app_id',
    signer: $signer,
    platformPrefix: 'XXX' // Platform prefix
);

$authorization = $requestSigner->generateAuthorization(
    method: 'POST',
    url: 'https://api.example.com/v1/pay',
    data: [
        'amount' => 100,
        'currency' => 'USD'
    ]
);