Package Data | |
---|---|
Maintainer Username: | deftnerd |
Maintainer Contact: | adam@deftnerd.com (Adam Brown) |
Package Create Date: | 2017-04-21 |
Package Last Update: | 2017-04-21 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:06:30 |
Package Statistics | |
---|---|
Total Downloads: | 253 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 2 |
Total Forks: | 3 |
Total Open Issues: | 0 |
Adds a Laravel validator for various cryptocurrency address formats.
Currently adds a onion
and bitcoin
validator. Planning to add the following soon:
Also planning to create the following validators under another project
Via Composer
$ composer require DeftNerd/CryptoAddressValidator
Add the following to the providers array in your config/app.php file
DeftNerd\CryptoAddressValidator\CryptoAddressServiceProvider::class
Base32, 16 characters, ends in '.onion'
Validator::make(['test' => 'facebookcorewwwi.onion'], ['test' => 'onion'])->passes(); //true
Validator::make(['test' => 'notarealonionaddress.onion'], ['test' => 'onion'])->passes(); //false
Validator::make(['test' => 'facebook.com'], ['test' => 'onion'])->passes(); //false
Checks for proper Base58 encoding, tests the checksum, verifies the network prefix byte is one of (mainnet regular, mainnet p2sh, testnet regular, testnet p2sh)
Validator::make(['test' => '1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v'], ['test' => 'bitcoin'])->passes(); // true (Bitcoin address)
Validator::make(['test' => 'n2eMqTT929pb1RDNuqEnxdaLau1rxy3efi'], ['test' => 'bitcoin'])->passes(); // true (Bitcoin Testnet address)
Validator::make(['test' => 'jsd8j8jksdjf9sj98'], ['test' => 'bitcoin'])->passes(); // false (random characters)
Validator::make(['test' => 'LQ3B36Yv2rBTxdgAdYpU2UcEZsaNwXeATk'], ['test' => 'bitcoin'])->passes(); // false (Litecoin address)
If you discover any security related issues, please email adam@deftnerd.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.