Skip to content

Signature SDK is a framework-agnostic PHP library that provides secure request signing and verification logic. It is the core signing engine used by laravel-signature, but can also be used independently in any PHP project.

Notifications You must be signed in to change notification settings

mitoop/signature-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Signature Sdk

Signature SDK is a framework-agnostic PHP library that provides secure request signing and verification logic. It is the core signing engine used by laravel-signature.

Requirements

  • PHP 7.4 or higher
  • OpenSSL extension enabled

Installation

Install via Composer:

composer require mitoop/signature-sdk

πŸš€ Quick Start

πŸ” Using RSA Signature:

use Mitoop\SignatureSdk\Client;
use Mitoop\SignatureSdk\RequestSigner;
use Mitoop\SignatureSdk\Signers\RsaSigner;

$privateKey = 'your_rsa_private_key_string';
$publicKey = 'plat_rsa_public_key_string';

$signer = new RsaSigner($privateKey, $publicKey);

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

$client = new Client(
    config: [
        'base_url' => 'https://api.example.com',
    ],
    signer: $requestSigner
);

$response = $client->post('/v1/pay', [
    'amount' => 100,
    'currency' => 'USD',
]);

$data = json_decode((string) $response->getBody(), true);

print_r($data);

About

Signature SDK is a framework-agnostic PHP library that provides secure request signing and verification logic. It is the core signing engine used by laravel-signature, but can also be used independently in any PHP project.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages