Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Hpack Test Case Laravel Package

http2jp/hpack-test-case

Generate and verify HPACK (HTTP/2 header compression) test cases for PHP. Provides fixtures and utilities to encode/decode header blocks and validate implementations against known-good examples. Handy for building or testing HTTP/2 clients/servers and HPACK libraries.

Deep Wiki
Context7

Getting Started

This package is a lightweight fixture library for HPACK (HTTP/2 header compression) test cases — no runtime code or Laravel integration required. To begin:

  1. Install as a dev dependency:
    composer require --dev http2jp/hpack-test-case
    
  2. Locate test vectors in vendor/http2jp/hpack-test-case/case*.json (e.g., case1.json, case2.json).
  3. In your tests/ suite, load and iterate over cases to validate your HPACK encoder/decoder implementation — e.g., compare expected_hex against your encoder output.

Start with the simplest case (e.g., case1.json) that encodes/decodes basic static-table headers — ideal for confirming core round-trip correctness before adding edge cases.

Implementation Patterns

  • Unit Test Harness: Use JSON fixtures as data providers in PHPUnit or Pest tests. Load cases via json_decode(file_get_contents(...), true) and assert encoder/decoder outputs match expected values.
  • CI Compliance Gate: Add a pre-commit or CI step that loads all cases and runs them through your HPACK stack — fail the build if mismatches occur (e.g., encode → decode ≠ original headers).
  • Integration Drift Detection: In proxy/GW services (e.g., Laravel-based API gateways using HTTP/2 via swoole/nginx), validate header compression behavior before and after deploys using these cases to catch unintended regressions.
  • Language Port Validation: When implementing HPACK in multiple languages (e.g., PHP + Rust + Go), share only these test cases to ensure parity — run identically in each runtime to guarantee interop.

Gotchas and Tips

  • No Autoloading: This is pure data — no classes, traits, or service bindings exist. Ignore any instinct to use or extend — treat it like database/fixtures/.
  • Hex Case Sensitivity: expected_hex is strictly lowercase (e.g., "a1b2c3"). Ensure your encoder outputs bin2hex($bytes) without 0x prefix or uppercase.
  • Stateful Cases: Some tests depend on dynamic table state (e.g., case2.json may assume a prior set_capacity call). Always reset the dynamic table to the RFC-specified initial size (4096 octets) before running a batch.
  • Missing Context: While header_set is provided, the exact sequence of Huffman encoding or index updates isn’t exposed — avoid assuming internal behavior; only validate input → output, not intermediate steps.
  • Repo Risk: With no public repository linked and "unknown" source, verify artifact integrity in CI (e.g., hash checks via composer audit or sensiolabs/security-checker). Treat as read-only test data — never process untrusted network payloads with logic derived from this repo.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style