Download the PHP package sycho/codecs-base64vlq without Composer

On this page you can find all versions of the php package sycho/codecs-base64vlq. 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 codecs-base64vlq

axy\codecs\base64vlq

Codec for VLQ (variable-length quantity) Base64 algorithm (PHP).

Latest Stable Version Minimum PHP Version Build Status Coverage Status

Documentation

VQL + Base64

Base64 allows us to represent a sequence of numbers in a text string that can be stored and transmit in text formats (JSON, XML, etc).

VLQ allows us to represent an integer in a sequence numbers with little digit capacity. For example 6 bit is the limit for Base64. The resulting numbers are called "VLQ digits". Small input number is represented by fewer VLQ-digits than big number. Thus VLQ is most effective if the input sequence is contains mainly the small numbers.

VLQ+Base64 allows us effectively represented a sequence of integers (dominated by a small number of) in the text format.

For example, it used in JavaScript/CSS source map.

The Algorithm

For example, we have a block of numbers: [12345, -12345, 0].

(1). VLQ only works with unsigned integers. Transfer the sign bit to the end of the integer.

12345 in binary is 11000000111001. Added 0 (positive) to the end: 110000001110010.

For -12345 take a positive form and add 1 (negative) to the end: 110000001110011.

Result is [110000001110010, 110000001110011, 0].

(2). Transform to the VLQ-sequence. For Base64 we need a block of 6-bit numbers. Most significant bit is reserved - it is "continuation".

Split numbers to groups of 5 bits: [11000 00011 10010, 11000 00011 10011, 00000]. Output starting from the least significant bits. If the group is not the last in the current number then set the continuation bit.

Result: [110010 100011 011000 110011 100011 011000 000000]. Or decimal [50, 35, 24, 51, 35, 24, 0]. These are VLQ digits.

(3). Replace the numbers on the letters of the Base64-alphabet. The standard alphabet is A..Za..z0..9+/.

Result is yjYzjYA.

How to use the library

Or default encoder can be obtained as follow:

In this case, the object creation and preliminary calculations are performed only once.

Custom options

The standard encoder uses standard options:

  1. Transfer the sign bit.
  2. 6-bit VLQ digits.
  3. Standard alphabet: A..Za..z0..9+/.

You can apply your settings:

Custom alphabet can be specified as a string (My Alphabet) or as an array ([1 => 'A', 10 => 'B', 15 => 'C', 20 => 'D']).

Exceptions

The error classes are located in the namespace axy\codecs\base64vlq\Encoder\Errors.

InvalidVLQSequence

z is 51 (the continuation bit = 1). The last digit must have 0 in continuation bit.

InvalidBase64

* are not in the standard Base64 alphabet.

InvalidBase64Input

For the standard encoder this exception should not occur.

Can occur for incorrect custom options:

10 bits is 1024 variants, but the alphabet contains only 3 letter.


All versions of codecs-base64vlq with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
sycho/errors Version ^3.0
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 sycho/codecs-base64vlq contains the following files

Loading the files please wait ....