Download the PHP package ocubom/base-convert without Composer

On this page you can find all versions of the php package ocubom/base-convert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package base-convert

[ ocubom/base-convert ](https://github.com/ocubom/base-convert/)

_Safe number conversion between arbitrary bases_ [![Version][packagist-img]][packagist-url] [![PHP version][packagist-php-img]][packagist-php-url] [![License][license-img]][license-url] [![Build status][workflow-build-img]][workflow-build-url] [![Coverage][coverage-img]][coverage-url] [![Downloads][packagist-dl-img]][packagist-dl-url] [![Issues][issues-img]][issues-url] [![Stargazers][stars-img]][stars-url] [![Forks][forks-img]][forks-url] [![Contributors][contributors-img]][contributors-url] [**Explore the docs »**](https://github.com/ocubom/base-convert/) · [Report Bug](https://github.com/ocubom/base-convert/issues) · [Request Feature](https://github.com/ocubom/base-convert/issues)
Table of Contents * [About ocubom/base-convert](#about-ocubombase-convert) * [Getting Started](#getting-started) * [Prerequisites](#prerequisites) * [Installation](#installation) * [Usage](#usage) * [Douglas Crockford Base 32 encoding](#douglas-crockford-base32-encoding) * [Base-58 encodings](#base-58-encodings) * [Roadmap](#roadmap) * [Support](#support) * [Authorship](#authorship) * [License](#license)

About ocubom/base-convert

ocubom/base-convert performs safe number conversion between arbitrary bases. The conversion uses a custom implementation to avoid the float precision problem of the native PHP base_convert function.

This implementation is extracted from the Symfony UID component. The class BinaryUtil implements the necessary fromBase and toBase methods. These methods were extracted to ensure compatibility and reduce the minimum PHP version required.

Getting Started

Prerequisites

Installation

Install the package via composer:

Usage

Simply import the namespaced base_convert and use it like the native function. Although this implementation is drop-in compatible with the native function, it provides several improvements:

[!Note] Positional Math vs. Stream Encoding

This library performs pure positional mathematical conversion. It treats the input bytes as a single, large integer and computes the output using successive divisions and remainders.

This is fundamentally different from stream-based encodings (like standard RFC 4648 Base64), which process data in fixed bit-chunks (e.g., 6-bit blocks) and often use padding (=).

Douglas Crockford base-32 encoding

A secure version of the base-32 encoding proposed by Douglas Crockford.

[!Note]

The encoding scheme is required to

  • Be human-readable and machine-readable.

  • Be compact. Humans have difficulty in manipulating long strings of arbitrary symbols.

  • Be error resistant. Entering the symbols must not require keyboarding gymnastics.

  • Be pronounceable. Humans should be able to accurately transmit the symbols to other humans using a telephone.

-- Douglas Crockford. base-32

This encoding is accessible:

An additional parameter can be added to include a checksum for error detection.

base-58 encodings

[!Warning]

Do not confuse Base58* with numeric base-58 (provided by the Numeric class).

Base-58 is a family of encoding schemes designed to provide a compact, human-readable representation of large integers. In order to make the output more readable, base-58 deliberately omits characters that can be easily confused by humans (such as 0, O, I, and l) and avoids non-alphanumeric symbols like + or /.

Although popularized by Bitcoin, several platforms have adapted the underlying mathematics using different character arrangements (alphabets) to suit their specific needs.

[!Note]

Why base-58 instead of standard base-64 encoding?

  • Don't want 0OIl characters that look the same in some fonts and could be used to create visually identical looking data.

  • A string with non-alphanumeric characters is not as easily accepted as input.

  • E-mail usually won't line-break if there's no punctuation to break at.

  • Double-clicking selects the whole string as one word if it's all alphanumeric.

-- Satoshi Nakamoto. Bitcoin source code

This package provides out-of-the-box support for the three most popular base-58 variants. They share the same math engine but use different alphabets:

These encodings are accessible by passing their respective objects as the base argument of the base_convert function:

Roadmap

See the open issues for a list of proposed features (and known issues).

Support

Reach out to the maintainer at GitHub Issues.

Authorship

Oscar Cubo Medina — https://ocubom.github.io

For a full list of all authors and contributors, see the contributors page.

License

Distributed under the MIT License.

See LICENSE for more information.


All versions of base-convert with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ocubom/base-convert contains the following files

Loading the files please wait ...