Download the PHP package nullbio/hegel-php without Composer

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

hegel-php

PHP SDK for the Hegel property-based testing protocol. Built on top of hegel-core (powered by Hypothesis), this library brings property-based testing to PHP with automatic shrinking, failure databases, and integration with Pest.

Status: In Development — The core runner, generator surface, Pest helper, manual stateful API, live hegel-core integration coverage, and level-8 static analysis are in place, but the package is still pre-release. See PLAN.md for the remaining roadmap and tradeoffs.

What is Property-Based Testing?

Instead of writing tests with specific example values, you describe properties that should hold for all valid inputs. The framework generates hundreds of random inputs, and when a test fails, automatically shrinks the failing input to the smallest possible counterexample.

How It Works

hegel-php is a thin client that speaks the Hegel protocol over a persistent subprocess connection. By default it uses hegel-core --stdio, with an explicit Unix-socket fallback available via HEGEL_SERVER_TRANSPORT=socket. Primitive generation, shrinking, and failure replay are handled by hegel-core, the same engine used by hegel-rust. Richer combinators are composed client-side to match the reference implementation instead of inventing PHP-specific protocol behavior.

This means PHP gets the same battle-tested shrinking behavior and core data generation strategies as other Hegel SDKs, powered by Hypothesis under the hood.

Requirements

Installation

The package name is nullbio/hegel-php:

Development

composer bench runs the local hot-path micro-benchmarks for CBOR encode/decode and generator schema construction.

Generators

Generator Description
Generators::integers() Integer values with optional ->minValue() / ->maxValue()
Generators::floats() Float values with bounds, NaN/infinity control
Generators::booleans() Boolean values
Generators::text() Unicode strings with optional size bounds
Generators::binary() Raw byte strings
Generators::arrays($gen) Arrays of generated elements with size bounds and ->unique()
Generators::maps($keyGen, $valueGen) Associative arrays (keys must be int or string in PHP)
Generators::hashSets($gen) Unique list-backed sets with size bounds
Generators::fixedDicts() Fixed-key dictionary builder via ->field(...)->build() or ->into(Foo::class)
Generators::tuples($gen1, $gen2, ...) Heterogeneous tuple/list generator
Generators::fixedArrays($gen, $size) Fixed-length homogeneous tuple/list generator
Generators::unit() Constant null unit-like generator
Generators::default($type, ...$args) PHP-native default resolver for scalars, containers, enums, and objects
Generators::object(Foo::class) Derived object generator with per-field overrides via ->with()
Generators::just($value) Always returns the given value
Generators::sampledFrom([...]) Uniformly sample from a fixed set
Generators::oneOf($gen1, $gen2, ...) Choose between generators
Generators::optional($gen) Value or null
Generators::emails() Valid email addresses
Generators::urls() Valid URLs
Generators::domains() Valid domain names with ->maxLength()
Generators::dates() Dates in YYYY-MM-DD format
Generators::times() Times in HH:MM:SS format
Generators::datetimes() ISO 8601 datetimes
Generators::ipAddresses() IPv4/IPv6 addresses with ->v4() / ->v6()
Generators::fromRegex($pattern) Strings matching a regex
Generators::composite(fn) Build custom generators from other generators

Derived Objects

When you want PHP-native defaults instead of spelling out every field manually, use Generators::default(...) or Generators::object(...).

Generators::default(...) supports:

Runtime notes:

Randomizer

Use $tc->randomizer() when you want shrinkable randomness through a PHP-native API instead of drawing every primitive manually.

Available methods currently mirror the useful native Random\Randomizer subset:

Use $tc->randomizer(true) to get a seeded native randomizer backed by one drawn seed instead of shrinkable per-call randomness.

Combinators

All generators support:

Configuration

The returned helper stays chainable with normal Pest methods too, so calls like ->group(), ->skip(), and ->throws() still work.

Setting Default Description
testCases 100 Number of random inputs to generate
seed random Fixed seed for reproducibility
verbosity normal quiet, normal, verbose, debug
derandomize auto Use deterministic seed from test name (auto-enabled in CI)

Public runtime failures are now grouped into:

Argument validation still uses standard PHP exceptions like InvalidArgumentException and ValueError.

Class-Based Tests

For Laravel-style or class-based Pest tests, use Hegel\Testing\InteractsWithHegel.

Inside the hegel() callback, the trait exposes the same convenience methods as the standalone TestCase: draw(), assume(), note(), and randomizer().

Stateful Testing

Stateful tests now support explicit StateMachine implementations, attribute-based discovery, and a conservative naming convention fallback. If a machine has no #[Rule] / #[Invariant] attributes, public ruleXxx() and invariantXxx() methods are discovered automatically. The attribute form is still the shortest way to write one:

The original explicit API still works when you want full control:

Attributed methods must be public, non-static, and accept either no arguments or a single TestCase argument.

Related Projects

License

MIT — see LICENSE.


All versions of hegel-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
nullbio/cbor-php Version 3.3.1
pestphp/pest Version 4.4.3
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 nullbio/hegel-php contains the following files

Loading the files please wait ...