Download the PHP package dev404ai/drand-client-php without Composer

On this page you can find all versions of the php package dev404ai/drand-client-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 drand-client-php

Drand Client for PHP

Build Status Psalm PHPStan Code Style: PSR-12 Mutation Testing Latest Stable Version Total Downloads License PHP Version Last Commit PRs Welcome

About

A minimal-dependency PHP client for the drand randomness beacon, providing fast, verifiable, and unbiased public randomness. Supports all drand signature schemes, efficient BLS verification via libblst, and is suitable for blockchain, games, lotteries, and any application requiring cryptographically secure randomness. Easy to install, PSR-4 autoloaded, and fully tested with PHPUnit.

Table of Contents

A minimal‑dependency PHP client for the drand randomness beacon.


Use Cases

This library can be used wherever verifiable, unbiased, and public randomness is required, including:

Drand randomness is public, distributed, and cryptographically verifiable, making it suitable for regulated and high-stakes environments.


Supported Signature Schemes

This client supports all major drand signature schemes:

Note:

  • For G1 and RFC9380 schemes, FFI and libblst are required.
  • The client automatically detects and verifies the correct scheme based on chain info.
  • BN254 support requires a separate backend (not included by default).

Quick install

1. Install libblst

Platform Command
Ubuntu / Debian sudo apt install libblst-dev
Arch Linux sudo pacman -S blst
Alpine Linux apk add blst
macOS (Homebrew) brew install blst
Windows Download blst.dll from the releases and copy it next to php.exe or into %SystemRoot%\System32.

Important: This project requires the php-ffi extension. Make sure it is installed and enabled in your PHP environment.

  • On Arch Linux, install it with:

  • On other systems, ensure the ffi extension is enabled in your php.ini (see below).
  • You can check if FFI is enabled by running:

    If you see ffi in the output, the extension is enabled.

Alternatively, build from source

2. Enable FFI

Reloading web SAPIs:
CLI picks the change immediately. For PHP‑FPM / Apache reload the service:

3. Install the client via Composer

This pulls the latest tagged release and registers PSR‑4 autoloading.

Verify setup


Usage Examples

Basic Usage

Advanced Configuration

Working with Rounds and Time

Error Handling

Using the Caching Client Directly

Using Multiple Chains

Using the Fastest Node

Selecting Network and Scheme via Configuration

You can use the built-in Networks class for easy selection of mainnet, testnet, or your own custom network:

The chainVerificationParams option ensures you are connecting to the correct network and using the correct signature scheme. The scheme is automatically detected from the chain info.

Advanced Usage Examples

Fetch beacon by time

Get time for a round

Print chain info and signature scheme

Use MultiChainClient and select by beaconID

Use FastestNodeClient


Configuration Enums

This library uses modern PHP 8.2+ enums for configuration:

Example: Creating a client with enums

Example: Multi-chain client

Example: Fastest node client


Configuration Files


Contributing

We welcome contributions and pull requests from the community!

For detailed contribution and testing guidelines, see CONTRIBUTING.md.

How to contribute:

For major changes, please open an issue first to discuss your proposal.

We appreciate your help in making this project better!


License

This project is dual-licensed under the MIT and Apache 2.0 licenses:

You may use this project under the terms of either license.


All versions of drand-client-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-curl Version *
ext-ffi 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 dev404ai/drand-client-php contains the following files

Loading the files please wait ...