Download the PHP package comely-io/buffer-php without Composer

On this page you can find all versions of the php package comely-io/buffer-php. 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 buffer-php

Buffer PHP

Buffer for PHP strings (ByteArray)

Prerequisites

Installation

composer require comely-io/buffer-php

Buffer

Constructors

Method Description
fromBase16 Initialize buffer using Base16/Hexadecimal encoded string
fromBase64 Initialize buffer from Base64 encoded string
fromByteArray Initialize buffer from byte array
fromBinary Initialize buffer from array of binary encoded bytes
__construct Creates a new buffer instance from given argument

Fixed-length Buffers

Methods

Method Description
len Get length/size of buffer in bytes
raw Get existing bytes in buffer as string
byteArray Returns an indexed Array comprised of every byte's position on ASCII table
copy Creates a copy of buffer from given start and/or up to length
equals Compares buffer bytes with another buffer or string
read Creates a ByteReader instance
hash Creates a ByteDigest instance
switchEndianess Converts endianess of entire buffer between big and little endians
dump Buffer information as an Array
applyFn Applies a function/callback to existing buffer creating a new buffer instance as result
toBase16 Encodes the buffer as Base16/Hexadecimal
toBase64 Encodes the buffer in Base64
toBinary Encodes the buffer into an indexed Array where each index is binary representation of byte (1s and 0s)
checkSize Checks if buffer is comprised of exactly same number of bytes as in argument, throws LengthException otherwise

Writeable Buffers

All the methods from fixed-length buffers above, and also:

Methods

Method Description
clean Flush any existing data in buffer
readOnly Puts buffer in Read-only state; Nothing further can be appended to it
writable Puts buffer in writable state
isWritable Return boolean
append Append bytes to end of buffer
prepend Prepend bytes to start of buffer
prependUInt8 Prepends a single byte integer
appendUInt8 Appends a single byte integer
appendUInt16LE Appends 2 byte integer in little endian byte order
appendUInt16BE Appends 2 byte integer in big endian byte order
appendUInt32LE Appends 4 byte integer in little endian byte order
appendUInt32BE Appends 4 byte integer in big endian byte order
appendUInt64LE Appends 8 byte integer in little endian byte order
appendUInt64BE Appends 8 byte integer in big endian byte order

ByteReader

For systematically reading bytes from buffer in order. Useful for serialization and un-serialization of data (i.e. Bitcoin blocks and transactions)

Methods

Method Description
ignoreUnderflow If invoked, ByteReaderUnderflowException will not be thrown if required number of bytes are not present
isEnd return boolean if end of buffer has been reached
len Length of buffer in bytes
pos Current position/index at byte in buffer
reset Resets position index to 0
first Resets position index to 0, then reads N number of bytes from start of buffer
lookBehind Reads last N bytes previously read (does NOT update internal pointer)
lookAhead Reads next N bytes but does NOT updates internal pointer
next Reads next N bytes while updating the pointer
readUInt8 Reads and converts next 1 byte as UInt8
readUInt16LE Reads and converts next 2 bytes as UInt16 from little endian byte order
readUInt16BE Reads and converts next 2 bytes as UInt16 from big endian byte order
readUInt32LE Reads and converts next 4 bytes as UInt32 from little endian byte order
readUInt32BE Reads and converts next 4 bytes as UInt32 from big endian byte order
readUInt64LE Reads and converts next 8 bytes as UInt64 from little endian byte order
readUInt64BE Reads and converts next 8 bytes as UInt64 from big endian byte order
setPointer Sets internal reading pointer to specified byte
remaining Retrieved all remaining bytes in buffer (does NOT update internal pointer)

ByteDigest

Applies hash function to bytes in buffer and returns digest bytes.

Check PHP.net hash_algos() and hash_hmac_algos() for list of available/supported algorithms.

Methods

Method Description
toString If invoked before any other method, all hash functions will return string instead of new buffer instance
hash Applies specified hash algorithm times N iterations and returns X numbers of bytes from digest
hmac Applies HMAC hash function
pbkdf2 Applies PBKDF2 hash function
md5 Applies md5 hash function
sha1 Applies SHA1 hash function
sha256 Applies SHA256 hash function
sha512 Applies SHA512 hash function
ripeMd160 Applies ripeMd160 hash function

All versions of buffer-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-gmp Version *
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 comely-io/buffer-php contains the following files

Loading the files please wait ....