定制 stephenhill/base58 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stephenhill/base58

Composer 安装命令:

composer require stephenhill/base58

包简介

Base58 Encoding and Decoding Library for PHP

README 文档

README

Packagist Release MIT License Action Status

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 2 will be supported until the 1st Janurary 2031.
  • Version 1 support expired on the 11th September 2019.

Background

I wanted a replacement for Base64 encoded strings and the Base58 encoding used by Bitcoin looked ideal. I looked around for an existing PHP library which would directly convert a string into Base58 but I couldn't find one, or at least one that worked correctly and was also well tested.

So I decided to create a library with the following goals:

  • Encode/Decode PHP Strings
  • Simple and easy to use
  • Fully Tested
  • Available via Composer

Requirements

This library has the following requirements:

  • PHP => 8.1
  • GMP or BC Math Extension

Installation

I recommend you install this library via Composer.

{
    "require": {
        "stephenhill/base58": "~2.0"
    }
}

Basic Usage

require_once('vendor/autoload.php');

$base58 = new StephenHill\Base58();

$base58->encode('Hello World');
$base58->decode('JxF12TrwUP45BMd');

Advanced Usage

By default this library chooses the encoding service provider to use, either GMPService or BCMathService (in that order). If you want to specify one of the included services or your own, you can inject it into the constructor.

require_once('vendor/autoload.php');

$gmp = new StephenHill\GMPService();
$base58 = new StephenHill\Base58(null, $gmp);

$base58->encode('Hello World');
$base58->decode('JxF12TrwUP45BMd');

Also by default, this library uses Bitcoin's Base58 alphabet. If you want to use another variant, you can do this in the constructor.

require_once('vendor/autoload.php');

// Flickr's Base58 Alphabet
$base58 = new StephenHill\Base58('123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ');

$base58->encode('Hello World');
$base58->decode('iXf12sRWto45bmC');

Testing

This library is tested using PHPUnit.

$ bin/phpunit

Contributing

I welcome everyone to contribute to this library. Please see the Contributing document for details.

License

This library is license under the MIT License (MIT). Please see License File for more information.

Credits

This library was forked from Jeremy Johnstone's Base58 methods on Gist https://gist.github.com/jsjohnst/126883.

Some of the unit tests were based on the following:

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

stephenhill/base58 适用场景与选型建议

stephenhill/base58 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.83M 次下载、GitHub Stars 达 85, 最近一次更新时间为 2014 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 stephenhill/base58 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 stephenhill/base58 我们能提供哪些服务?
定制开发 / 二次开发

基于 stephenhill/base58 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.83M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 91
  • 点击次数: 19
  • 依赖项目数: 84
  • 推荐数: 0

GitHub 信息

  • Stars: 85
  • Watchers: 4
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-29