PHPackages                             php-core/wert-sc-signer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. php-core/wert-sc-signer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

php-core/wert-sc-signer
=======================

PHP library for SmartContracts Wert's requests signing simplification

1.0.1(8mo ago)01.1kMITPHPPHP &gt;=8.0

Since Aug 6Pushed 8mo agoCompare

[ Source](https://github.com/php-core/wert-sc-signer)[ Packagist](https://packagist.org/packages/php-core/wert-sc-signer)[ RSS](/packages/php-core-wert-sc-signer/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

WertWidget Smart Contract Signing Helper
========================================

[](#wertwidget-smart-contract-signing-helper)

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

[](#installation)

```
composer require php-core/wert-sc-signer
```

Usage
-----

[](#usage)

### Standard PHP

[](#standard-php)

```
use PHPCore\WertScSigner\WertScSigner;

$signedData = WertScSigner::signSmartContractData($options, $privateKey);
```

### Laravel

[](#laravel)

The package includes Laravel integration. The service provider and facade will be automatically registered.

1. Publish the configuration file:

```
php artisan vendor:publish --provider="PHPCore\WertScSigner\Laravel\WertScSignerServiceProvider" --tag="config"
```

2. Add your Wert private key to your .env file:

```
WERT_PRIVATE_KEY=your_private_key_here
```

3. Use the facade in your code:

```
use PHPCore\WertScSigner\Laravel\Facades\WertScSigner;

$dataWithSignature = WertScSigner::signSmartContractData($options);
```

Function **signSmartContractData** returns the given options array with an addition of a "**signature**" property. You can pass the result directly to WertWidget initializer.

#### Using Multiple Credentials

[](#using-multiple-credentials)

The package supports using multiple API credentials in the same Laravel project. This is useful when you need to:

- Separate credentials by environment (production, staging, etc.)
- Use different credentials for different partners or clients
- Manage multiple Wert accounts

**Configuration:**

Update your `config/wert-sc-signer.php` file:

```
return [
    'private_key' => env('WERT_PRIVATE_KEY'), // Legacy support

    'credentials' => [
        'default' => env('WERT_PRIVATE_KEY'),
        'production' => env('WERT_PRIVATE_KEY_PRODUCTION'),
        'staging' => env('WERT_PRIVATE_KEY_STAGING'),
        'partner_a' => env('WERT_PRIVATE_KEY_PARTNER_A'),
        'partner_b' => env('WERT_PRIVATE_KEY_PARTNER_B'),
    ],

    'default_credential' => env('WERT_DEFAULT_CREDENTIAL', 'default'),
];
```

Add the corresponding environment variables to your `.env` file:

```
WERT_PRIVATE_KEY=your_default_key
WERT_PRIVATE_KEY_PRODUCTION=your_production_key
WERT_PRIVATE_KEY_STAGING=your_staging_key
WERT_PRIVATE_KEY_PARTNER_A=partner_a_key
WERT_PRIVATE_KEY_PARTNER_B=partner_b_key
WERT_DEFAULT_CREDENTIAL=default
```

**Usage:**

```
use PHPCore\WertScSigner\Laravel\Facades\WertScSigner;

// Use the default credential (backward compatible)
$dataWithSignature = WertScSigner::signSmartContractData($options);

// Use a specific credential with withCredential()
$dataWithSignature = WertScSigner::withCredential('production')->sign($options);
$dataWithSignature = WertScSigner::withCredential('partner_a')->sign($options);

// Or pass the credential name to the sign() method
$dataWithSignature = WertScSigner::sign($options, 'staging');
```

**Dynamic Credential Selection:**

You can select credentials dynamically based on your application logic:

```
// Based on environment
$credential = app()->environment('production') ? 'production' : 'staging';
$dataWithSignature = WertScSigner::withCredential($credential)->sign($options);

// Based on user/tenant
$credential = $user->wert_credential_name ?? 'default';
$dataWithSignature = WertScSigner::withCredential($credential)->sign($options);

// Based on partner
$credential = match($partnerId) {
    'partner-a' => 'partner_a',
    'partner-b' => 'partner_b',
    default => 'default',
};
$dataWithSignature = WertScSigner::withCredential($credential)->sign($options);
```

### Options

[](#options)

PropertyRequiredTypeDescription**address**required*string*User's address that will act as a fallback address if a smart contract can't be executed. In case of fallback, Wert will transfer commodity\_amount to this address**commodity**required*string*[List of supported currencies](https://docs.wert.io/docs/supported-coins-and-blockchains)**network**optional*string*[List of supported currencies](https://docs.wert.io/docs/supported-coins-and-blockchains)**commodity\_amount**required*numeric*An amount of crypto necessary for executing the given smart contract**sc\_address**required*string*The address of the smart contract**sc\_input\_data**required*string*Data that will be used for smart contract execution, in the hex format### Example

[](#example)

```
$commodity = 'ETH';
$network = 'ethereum';
$options = [
    // required generally:
    "partner_id" => "...",

    // required for signing:
    'address' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', // NFT receipient
    'commodity_id' => strtolower($commodity) . '_' . strtolower($network) . '.sc.ethereum',
    'commodity' => $commodity,
    'commodity_amount' => 1.5,
    'network' => $network,
    'sc_address' => '0x...', // smart contract address
    'sc_input_data' => '...', // input data (learn more: https://docs.wert.io/docs/forming-input-data)

    // ...
];

$privateKey = 'your_private_key_here';
$dataWithSignature = WertScSigner::signSmartContractData($options, $privateKey);
```

### Private key

[](#private-key)

Was given to you during your registration in the **Wert** system as a partner. If you don't have one, [contact Wert](https://wert.io/for-partners).

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- ext-sodium

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance62

Regular maintenance activity

Popularity18

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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 ~90 days

Total

2

Last Release

241d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/103283996?v=4)[PHP Core](/maintainers/php-core)[@php-core](https://github.com/php-core)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-core-wert-sc-signer/health.svg)

```
[![Health](https://phpackages.com/badges/php-core-wert-sc-signer/health.svg)](https://phpackages.com/packages/php-core-wert-sc-signer)
```

###  Alternatives

[fluidtypo3/flux

The flux package from FluidTYPO3

1501.0M25](/packages/fluidtypo3-flux)[lemonsqueezy/plain-ui-components

Plain UI Components for Laravel

25323.5k](/packages/lemonsqueezy-plain-ui-components)[hcodes/server_yametrika

Server-side tracking of visitors using Yandex.Metrica

7521.4k](/packages/hcodes-server-yametrika)[terabin/flarum-ext-sitemap

Generate a Sitemap for Flarum automatically

123.0k1](/packages/terabin-flarum-ext-sitemap)

PHPackages © 2026

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