Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
75a27b3
Update README.md
mehrshaddarzi Mar 23, 2023
be678ec
contracts
LiquidCats Apr 21, 2023
604540e
enum
LiquidCats Apr 21, 2023
413410b
utils
LiquidCats Apr 21, 2023
ef557da
exceptions
LiquidCats Apr 21, 2023
03e3f23
config
LiquidCats Apr 21, 2023
0e7f468
clean up
LiquidCats Apr 21, 2023
136309e
clean up
LiquidCats Apr 21, 2023
fd3e2c9
validation drivers
LiquidCats Apr 21, 2023
d14f22c
driver config
LiquidCats Apr 21, 2023
53fb5b9
validator
LiquidCats Apr 21, 2023
4d09228
provider
LiquidCats Apr 21, 2023
c1391f9
extend requirements
LiquidCats Apr 24, 2023
453207d
adjust config
LiquidCats Apr 24, 2023
03dab50
provide tests
LiquidCats Apr 24, 2023
0b59cc8
fix after testing
LiquidCats Apr 24, 2023
cb0b916
update read me
LiquidCats Apr 24, 2023
42289f4
remove unused
LiquidCats Apr 24, 2023
44a56b9
Merge pull request #25 from mehrshaddarzi/patch-1
androzd May 12, 2023
d904002
fix configs
LiquidCats May 17, 2023
6d092e9
fix configs
LiquidCats May 22, 2023
c4e4255
make not strict driver
LiquidCats May 22, 2023
827b8d1
tests
LiquidCats May 22, 2023
5e5af51
remove unused
LiquidCats May 22, 2023
8e3aad0
Merge branch 'master' into improve-codebase-using-some-internal-stuff
LiquidCats May 30, 2023
6675c95
Merge pull request #26 from LiquidCats/improve-codebase-using-some-in…
androzd Jun 13, 2023
7e21106
add new driver
LiquidCats Jun 29, 2023
5b2054a
aad testnet
LiquidCats Jun 29, 2023
1d87ebb
code style
LiquidCats Jun 29, 2023
b2c1bb6
Merge pull request #27 from LiquidCats/add-cbor-driver
androzd Jun 29, 2023
14265b4
update cbor to make compatible with laravel 10
LiquidCats Jun 29, 2023
2bbf327
Merge pull request #28 from LiquidCats/fix-add-cbor-driver
androzd Jun 30, 2023
1f2df04
lower case addresses
LiquidCats Jun 30, 2023
58007f3
make validation softer for BCH
LiquidCats Jun 30, 2023
3aa9112
test coverage
LiquidCats Jun 30, 2023
7e6fde1
Merge pull request #29 from LiquidCats/soften-validation-for-btc-bch
androzd Jun 30, 2023
06b1c07
fix
LiquidCats Jul 3, 2023
40bdd30
Merge pull request #30 from LiquidCats/fix-btc
androzd Jul 3, 2023
234ba12
fix typo
LiquidCats Jul 3, 2023
6007822
Merge pull request #31 from LiquidCats/fix-typo
androzd Jul 3, 2023
7b2df60
add GH action with tests
LiquidCats Jul 4, 2023
c4b41f4
remove composer validation
LiquidCats Jul 4, 2023
097cca2
add php version
LiquidCats Jul 4, 2023
c020cc9
Merge pull request #32 from LiquidCats/actions
androzd Jul 4, 2023
928b049
feature: long p-address support
ilyashabanov-cp Aug 29, 2023
af4c1cc
Merge pull request #1 from LiquidCats/feature/bch-long-p-addresses-su…
LiquidCats Aug 29, 2023
4f54897
Merge pull request #33 from LiquidCats/master
androzd Aug 29, 2023
25e3538
feature(validators): add bech32m support
LiquidCats Nov 1, 2023
a014b76
Merge pull request #35 from LiquidCats/feature/add-bech32m-addresses-…
androzd Nov 6, 2023
280ae94
Fix LTC testnet address validation
romikring Nov 6, 2023
bf85d0d
Merge pull request #36 from romikring/ltc-patch
androzd Nov 6, 2023
ebf2a27
fix: driver config construction from cache
Nov 30, 2023
fa4e7fa
Merge pull request #37 from alexeyvy/master
androzd Dec 1, 2023
7bbe0fe
Merge upstream changes from Merkeleon/php-cryptocurrency-address-vali…
humancopyright Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Unit Tests

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: shivammathur/setup-php@master
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Using @master branch reference is a security risk. Pin to a specific version tag (e.g., @v2) or commit SHA to ensure reproducible and secure builds. The master branch can change at any time, potentially breaking builds or introducing vulnerabilities.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/tests.yml, line 20:

<comment>Using `@master` branch reference is a security risk. Pin to a specific version tag (e.g., `@v2`) or commit SHA to ensure reproducible and secure builds. The master branch can change at any time, potentially breaking builds or introducing vulnerabilities.</comment>

<file context>
@@ -0,0 +1,37 @@
+    steps:
+      - uses: actions/checkout@v3
+
+      - uses: shivammathur/setup-php@master
+        with:
+          php-version: '8.2'
</file context>
Suggested change
- uses: shivammathur/setup-php@master
- uses: shivammathur/setup-php@v2
Fix with Cubic

with:
php-version: '8.2'

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: composer test
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
Easy to use PHP Bitcoin and Litecoin address validator.
One day I will add other crypto currencies. Or how about you? :)

## Usage
## Installation

=======
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Leftover git merge conflict marker ======= should be removed. This will render as visible text in the README.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At README.md, line 8:

<comment>Leftover git merge conflict marker `=======` should be removed. This will render as visible text in the README.</comment>

<file context>
@@ -3,13 +3,19 @@
-## Usage
+## Installation
 
+=======
+```
+composer require merkeleon/php-cryptocurrency-address-validation
</file context>
Fix with Cubic

```
composer require merkeleon/php-cryptocurrency-address-validation
```

## Usage

```php
use Merkeleon\PhpCryptocurrencyAddressValidation\Validation;
use Merkeleon\PhpCryptocurrencyAddressValidation\Enums\CurrencyEnum;use Merkeleon\PhpCryptocurrencyAddressValidation\Validator;

$validator = Validation::make('BTC');
var_dump($validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp'));
$validator = Validator::make(CurrencyEnum::BITCOIN);
var_dump($validator->isValid('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp'));

```
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
}
],
"require": {
"php": "^8.1",
"spomky-labs/cbor-php": "^2.0"
"php": "^8.2",
"ext-gmp": "*",
"ext-bcmath": "*",
"laravel/framework": ">=v7.0.0|>=v10.0.0",
"spomky-labs/cbor-php": "^3.0"
},
"scripts": {
"test": "@php vendor/bin/phpunit"
},
"require-dev": {
"phpunit/phpunit": "~8.0"
Expand All @@ -25,4 +31,3 @@
}
}
}

108 changes: 108 additions & 0 deletions config/address_validation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php

declare(strict_types=1);

use Merkeleon\PhpCryptocurrencyAddressValidation\DriverConfig;
use Merkeleon\PhpCryptocurrencyAddressValidation\Drivers;
use Merkeleon\PhpCryptocurrencyAddressValidation\Enums\CurrencyEnum;

return [
CurrencyEnum::BEACON->value => [
new DriverConfig(
Drivers\Bech32Driver::class,
['bnb' => null],
['tbnb' => null]
),
],
CurrencyEnum::BITCOIN_CASH->value => [
new DriverConfig(
Drivers\Base32Driver::class,
['bitcoincash:' => null],
['bchtest:' => null, 'bchreg:' => null,]
),
new DriverConfig(
Drivers\DefaultBase58Driver::class,
['1' => '00', '3' => '05'],
['2' => 'C4', 'm' => '6F']
),
],
CurrencyEnum::BITCOIN->value => [
new DriverConfig(
Drivers\DefaultBase58Driver::class,
['1' => '00', '3' => '05'],
['2' => 'C4', 'm' => '6F']
),
new DriverConfig(
Drivers\Bech32Driver::class,
['bc' => null],
['tb' => null, 'bcrt' => null]
),
],
CurrencyEnum::CARDANO->value => [
new DriverConfig(
Drivers\CardanoDriver::class,
['addr' => null],
['addr_test' => null],
),
new DriverConfig(
Drivers\CborDriver::class,
['A' => 33, 'D' => 66],
['2' => 40, '3' => 73],
)
],
CurrencyEnum::DASHCOIN->value => [
new DriverConfig(
Drivers\DefaultBase58Driver::class,
['X' => '4C', '7' => '10'],
['y' => '8C', '8' => '13']
),
],
CurrencyEnum::DOGECOIN->value => [
new DriverConfig(
Drivers\DefaultBase58Driver::class,
['D' => '1E', '9' => '16', 'A' => '16'],
['n' => '71', 'm' => '6F', '2' => 'C4',],
),
],
CurrencyEnum::EOS->value => [
new DriverConfig(Drivers\EosDriver::class),
],
CurrencyEnum::ETHEREUM->value => [
new DriverConfig(Drivers\KeccakStrictDriver::class),
],
CurrencyEnum::LITECOIN->value => [
new DriverConfig(
Drivers\DefaultBase58Driver::class,
['L' => '30', 'M' => '32', '3' => '05'],
['m' => '6F', 'n' => '6F', '2' => 'C4', 'Q' => '3A']
),
new DriverConfig(
Drivers\Bech32Driver::class,
['ltc' => null],
['tltc' => null, 'rltc' => null]
)
],
CurrencyEnum::RIPPLE->value => [
new DriverConfig(
Drivers\XrpBase58Driver::class,
['r' => '00']
),
new DriverConfig(
Drivers\XrpXAddressDriver::class,
['X' => null],
['T' => null],
),
],
CurrencyEnum::TRON->value => [
new DriverConfig(
Drivers\DefaultBase58Driver::class,
['T' => '41'],
),
],
CurrencyEnum::ZCASH->value => [
new DriverConfig(
Drivers\DefaultBase58Driver::class,
['t' => '1C'],
),
],
];
17 changes: 17 additions & 0 deletions src/AddressValidationServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Merkeleon\PhpCryptocurrencyAddressValidation;

use Illuminate\Support\ServiceProvider;

class AddressValidationServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->publishes([
__DIR__.'/../config/address_validation.php' => config_path('address_validation.php'),
]);
}
}
185 changes: 0 additions & 185 deletions src/Base58Validation.php

This file was deleted.

Loading
Loading