Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Base58

on:
push:
branches: [main, goodsprings]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [8.1, 8.2, 8.3, 8.4, 8.5]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

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

- name: Run PHPUnit
run: bin/phpunit --no-coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
/coverage/
/bin/
composer.lock
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

24 changes: 0 additions & 24 deletions benchmarks/Base16Event.php

This file was deleted.

33 changes: 0 additions & 33 deletions benchmarks/Base58BCMathEvent.php

This file was deleted.

33 changes: 0 additions & 33 deletions benchmarks/Base58GMPEvent.php

This file was deleted.

24 changes: 0 additions & 24 deletions benchmarks/Base64Event.php

This file was deleted.

13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"name": "stephenhill/base58",
"description": "Base58 Encoding and Decoding Library for PHP",
"require": {
"php": ">=8.1"
},
"suggest": {
"ext-bcmath": "Required for BC Math support",
"ext-gmp": "Required for GMP support"
},
"require-dev": {
"phpunit/phpunit": "4.*",
"athletic/athletic": "~0.1"
"phpunit/phpunit": "10.*"
},
"license": "MIT",
"authors": [
Expand All @@ -17,8 +23,7 @@
},
"autoload": {
"psr-4": {
"StephenHill\\": "src/",
"StephenHill\\Benchmarks\\": "benchmarks/"
"StephenHill\\": "src/"
}
}
}
55 changes: 26 additions & 29 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false"
syntaxCheck="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="Base58 Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.3/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheResult="false"
beStrictAboutOutputDuringTests="true"
displayDetailsOnAllIssues="true"
failOnAllIssues="true"
colors="true">

<filter>
<whitelist addUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src</directory>
<exclude>
<directory suffix=".php">vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
<testsuites>
<testsuite name="unit">
<directory>tests</directory>
</testsuite>
</testsuites>

<source>
<include>
<directory>src</directory>
</include>
</source>

<coverage>
<report>
<html outputDirectory="coverage"/>
</report>
</coverage>
</phpunit>
54 changes: 8 additions & 46 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Base58 Encoding and Decoding Library for PHP

[![Build Status](https://travis-ci.org/stephen-hill/base58php.png)](https://travis-ci.org/stephen-hill/base58php)
[![Packagist Release](http://img.shields.io/packagist/v/stephenhill/base58.svg)](https://packagist.org/packages/stephenhill/base58)
[![MIT License](http://img.shields.io/packagist/l/stephenhill/base58.svg)](https://github.com/stephen-hill/base58php/blob/master/license)
[![Flattr this](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=stephen-hill&url=https%3A%2F%2Fgithub.com%2Fstephen-hill%2Fbase58php)
[![Action Status](https://github.com/stephen-hill/base58php/actions/workflows/php.yml/badge.svg)](https://github.com/stephen-hill/base58php/actions/workflows/php.yml)

## Long Term Support

Each major version of this library will be supported for 5 years after it's initial release. Support will be provided for security and bug fixes.

Version 1 will therefore be supported until the 11th September 2019.
- Version 2 will be supported until the 1st Janurary 2031.
- Version 1 support expired on the 11th September 2019.

## Background

Expand All @@ -26,8 +26,8 @@ So I decided to create a library with the following goals:

This library has the following requirements:

- PHP => 5.3
- BC Math Extension
- PHP => 8.1
- GMP or BC Math Extension

## Installation

Expand All @@ -36,7 +36,7 @@ I recommend you install this library via Composer.
```json
{
"require": {
"stephenhill/base58": "~1.0"
"stephenhill/base58": "~2.0"
}
}
```
Expand Down Expand Up @@ -87,46 +87,6 @@ This library is tested using PHPUnit.
$ bin/phpunit
```

## Benchmarking

You can benchmark this library using [Athletic](https://github.com/polyfractal/athletic).
The benchmarking suite also benchmarks PHP's built-in Base64 and Base16 encoding for comparison.

```bash
$ bin/athletic -p benchmarks
```

Example output.

```
StephenHill\Benchmarks\Base16Event
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase16: [10,000 ] [0.0000010839939] [922,514.40637]
decodeBase16: [10,000 ] [0.0000011516809] [868,296.03561]


StephenHill\Benchmarks\Base58BCMathEvent
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase58: [10,000 ] [0.0001500048161] [6,666.45263]
decodeBase58: [10,000 ] [0.0001741812706] [5,741.14540]


StephenHill\Benchmarks\Base58GMPEvent
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase58: [10,000 ] [0.0001168665648] [8,556.76730]
decodeBase58: [10,000 ] [0.0001385705233] [7,216.54199]


StephenHill\Benchmarks\Base64Event
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase64: [10,000 ] [0.0000009050369] [1,104,927.29189]
decodeBase64: [10,000 ] [0.0000009787321] [1,021,730.04312]
```

## Contributing

I welcome everyone to contribute to this library. Please see the Contributing document for details.
Expand All @@ -143,3 +103,5 @@ Some of the unit tests were based on the following:

- https://code.google.com/p/bitcoinj/source/browse/core/src/test/java/com/google/bitcoin/core/Base58Test.java
- https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/fixtures/base58.json

In no particular order, I would like to thank the following for pushing me to release a PHP 8 compatible version: @git-marijus, @VandalorumRex, @bacheson, @kalifg
Loading