Download the PHP package fatkulnurk/radix-converter without Composer

On this page you can find all versions of the php package fatkulnurk/radix-converter. 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 radix-converter

Radix Converter PHP

A type-safe library to convert numbers into short strings and back. Perfect for URL shorteners, unique IDs, and compact representations.

Packagist


Table of Contents


What Does This Do?

This library converts numbers like 12345 into short strings like "3d7" and back. This is useful for:

Installation

Run this command in your terminal:

Requirements

Quick Start

Here's the simplest way to use it:

Built-in Converters

The library comes with 5 built-in converters:

Name Characters Used Base Example Output
BASE62 Numbers + lowercase + uppercase 62 3d7
ALPHA_NUMERIC_UPPER Numbers + uppercase letters 36 RS
ALPHA_NUMERIC_LOWER Numbers + lowercase letters 36 rs
ALPHA_ONLY Letters only (no numbers) 52 cU
HEX Numbers + a-f 16 ff

How Each Strategy Works

All converters extend AbstractBaseConverter which uses the radix (base-N) algorithm:

Encoding (number → string):

  1. Divide the number by the base
  2. Use the remainder to pick a character from the charset
  3. Repeat with the quotient until it becomes 0
  4. Read the result from last to first

Decoding (string → number):

  1. Start with 0
  2. For each character, multiply result by base and add the character's position value
  3. Return the final number

1. Base62 Strategy (Most Compact)

Example calculation for 12345:

2. Alphanumeric Upper Strategy

3. Alphanumeric Lower Strategy

4. Alpha Only Strategy

5. Hex Strategy (Custom)

Common Use Cases

1. URL Shortener

Convert database IDs into short codes for URLs:

2. Different Converter Types

3. Error Handling

The library will throw errors if you try to:

Custom Converters

You can create your own converter for any base system.

Using the Built-in Hex Converter

Creating Your Own Converter

For Laravel Users

Laravel Octane / Swoole Warning

If you use Laravel Octane or Swoole, do NOT use CustomConverterRegistry because it keeps data between requests, which can cause problems.

Instead, use ConverterManager:

Using in Laravel Controllers

More Examples

The library includes example files you can run:

CI/CD

This project uses GitHub Actions for continuous integration. The workflow is configured in .github/workflows/ci.yml.

How It Works

The CI pipeline runs automatically on:

Workflow Steps

Step Description
Checkout Clones your code from GitHub
Setup PHP Installs PHP 8.5 with required extensions
Install Dependencies Runs composer install to get all packages
Run Tests Executes PHPUnit tests via composer test

Running Tests Locally

Before pushing your changes, run tests locally:

Customizing the Workflow

To test on multiple PHP versions, edit .github/workflows/ci.yml:

License

MIT License - free to use in your projects.


All versions of radix-converter with dependencies

PHP Build Version
Package Version
Requires php Version >=8.5
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 fatkulnurk/radix-converter contains the following files

Loading the files please wait ...