PHPackages                             mstefan/php-ecrecover - 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. mstefan/php-ecrecover

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

mstefan/php-ecrecover
=====================

PHP ECRecover Example

0.1(4y ago)013CC0-1.0PHPPHP &gt;=7.1.0

Since Nov 16Pushed 4y agoCompare

[ Source](https://github.com/ManciuStefan/php-ecrecover)[ Packagist](https://packagist.org/packages/mstefan/php-ecrecover)[ RSS](/packages/mstefan-php-ecrecover/feed)WikiDiscussions master Synced today

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

php-ecrecover
=============

[](#php-ecrecover)

This project is showing you how to sign from client-side(browser, javascript) and verify from server-side(php).

Check out this repo to see JS Signature Example:

eth\_sign &amp; verify
----------------------

[](#eth_sign--verify)

- JS Sign

```
var msg = '0xca5e3f850877ea106134e2a2c8d7c0018a9d412b59abe623b2d1a432f0d163a8'
var from = web3.eth.accounts[0]
web3.eth.sign(from, msg, function (err, result) {
if (err) return console.error(err)
console.log('SIGNED:' + result)
})
```

- PHP Verify

```
$hex = '0xca5e3f850877ea106134e2a2c8d7c0018a9d412b59abe623b2d1a432f0d163a8';
$signed = '0x7b87a3c4dd63bee43d4c880391bb0aaaf210c12356406152a30edc424b9c4de62cc64a266b6faf22691a36489651f1cbf7dee1f028ba24b7d48e5552eac4c93f1b';
echo ecRecover($hex, $signed), "\n";
```

personal\_sign
--------------

[](#personal_sign)

- JS Sign

```
var text = 'Hello!!';
var msg = ethUtil.bufferToHex(new Buffer(text, 'utf8'))
var from = web3.eth.accounts[0]
var params = [msg, from]
var method = 'personal_sign'

web3.currentProvider.sendAsync({
    method,
    params,
    from,
}, function (err, result) {
    if (err) return console.error(err)
    if (result.error) return console.error(result.error)
    console.log('PERSONAL SIGNED:' + JSON.stringify(result.result))
});
```

- PHP Verify

```
$msg = 'Hello!!';
$signed = '0x7b87a3c4dd63bee43d4c880391bb0aaaf210c12356406152a30edc424b9c4de62cc64a266b6faf22691a36489651f1cbf7dee1f028ba24b7d48e5552eac4c93f1b';
echo personal_ecRecover($msg, $signed), "\n";
```

sign typed data
---------------

[](#sign-typed-data)

- JS Sign

```
const msgParams = [
    {
        type: 'string',
        name: 'Message',
        value: 'Hi, Alice!'
    },
    {
        type: 'uint32',
        name: 'A number',
        value: '1337'
    }
]
var from = web3.eth.accounts[0]
var params = [msgParams, from]
var method = 'eth_signTypedData'

web3.currentProvider.sendAsync({
    method,
    params,
    from,
}, function (err, result) {
    if (err) return console.dir(err)
    if (result.error) {
      alert(result.error.message)
    }
    if (result.error) return console.error(result)
    console.log('PERSONAL SIGNED:' + JSON.stringify(result.result))
}
```

- PHP Verify

```
$presha_str = hex2bin(substr(keccak256('string Messageuint32 A number'), 2) . substr(keccak256('Hi, Alice!'. pack('N', 1337)), 2));
$hex = keccak256($presha_str);
$signed = '0x5147f94643843d709bf7c374fb8d619b27da739413f7ab8de5c788a6b7d2d10e53c4789d8a0398dee6c9f6cb69e094fa801cc00fa4d19f3b71b03a7a4b7cfee11c';
echo ecRecover($hex, $signed), "\n";
```

References
----------

[](#references)

-
-
- [ethereum/EIPs#712](https://github.com/ethereum/EIPs/pull/712)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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

Unknown

Total

1

Last Release

1636d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0c752ed632852c01d67cf823067e465723e5ce24b2eae3619d316ebb6c1f346?d=identicon)[ManciuStefan](/maintainers/ManciuStefan)

---

Top Contributors

[![ManciuStefan](https://avatars.githubusercontent.com/u/2658295?v=4)](https://github.com/ManciuStefan "ManciuStefan (3 commits)")[![wmh](https://avatars.githubusercontent.com/u/50888?v=4)](https://github.com/wmh "wmh (2 commits)")[![s3827035](https://avatars.githubusercontent.com/u/62316000?v=4)](https://github.com/s3827035 "s3827035 (1 commits)")

---

Tags

ecrecover

### Embed Badge

![Health badge](/badges/mstefan-php-ecrecover/health.svg)

```
[![Health](https://phpackages.com/badges/mstefan-php-ecrecover/health.svg)](https://phpackages.com/packages/mstefan-php-ecrecover)
```

###  Alternatives

[kornrunner/ethereum-offline-raw-tx

Pure PHP Ethereum Offline Raw Transaction Signer

63192.1k22](/packages/kornrunner-ethereum-offline-raw-tx)[web3p/ethereum-util

A collection of utility functions for Ethereum written in PHP.

30420.2k26](/packages/web3p-ethereum-util)[kornrunner/ethereum-address

Pure PHP Ethereum Address Generator / Validator

41113.1k7](/packages/kornrunner-ethereum-address)[digitaldonkey/ecverify

A library integrating Ethereum with typed PHP.

14109.2k2](/packages/digitaldonkey-ecverify)[kornrunner/solidity

Pure PHP implementation of Solidity

1940.5k11](/packages/kornrunner-solidity)

PHPackages © 2026

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