gmajor/substrate-codec-php
PHP implementation of the Substrate SCALE codec for encoding and decoding Polkadot/Substrate data structures, with compact serialization for integers, strings, arrays, tuples, and custom types in PHP applications.
Verdict: A small, stateless, MIT-licensed SCALE encoder/decoder for PHP. It is a legitimate primitive, not a blockchain SDK — treat it as a low-risk leaf dependency that you must wrap, pin, and conformance-test, and assume you are the maintainer of last resort.
Architecture fit
Vec, tuples, structs, enums/Option/Result). No I/O, no globals, no framework coupling — trivially safe to place in the domain layer of a Laravel app.ScaleCodec), called by an RPC client layer, itself called by application services. Do not let gmajor\... types leak into domain or controller code.Integration feasibility
blake2b-256/xxhash hashing required to hash an encoded call before signing, (b) SS58 address encode/decode, (c) runtime metadata (v14/v15) parsing and type registry, (d) any signing (sr25519/ed25519/ecdsa). If any are missing, they become separate dependencies or force read-only scope.Technical risk
u128/u256; correct handling depends on ext-gmp/ext-bcmath and 64-bit builds. This is the most likely source of subtle production defects.Vec/Bytes decoding invites memory exhaustion and unbounded loops. Codec must enforce caps; verify it does.gmajor/substrate-codec-php) does not match the reviewed repository (php-scale-codec), and the reported release date (2026-03-30) is anomalous. Verify on Packagist that the installed package resolves to the audited commits, that tags are signed/immutable, and that semver is honored.Key questions
Stack fit
ext-gmp and ext-bcmath available in the container image. Confirm the extensions in the Dockerfile before the first commit — not in staging.Http or Guzzle) and your signing/serialization service. Keep transport, codec, and signing as three separate collaborators so each is independently testable and replaceable.Migration path
pack('v'), pack('P'), manual hex concatenation) to read chain state, migrate in reverse order of risk: replace decoding first (read-only, failures are loud and non-destructive), then encoding of unsigned payloads, then signing.Compatibility
composer.json and commit composer.lock. Do not accept floating ranges on a package with one maintainer and zero dependents.Sequencing
subxt/polkadot-js) for the same inputs.Maintenance
Support
Scaling
u128-heavy loops and peak memory on large Vec decode. Set explicit memory and time limits on any job that decodes chain-supplied bytes.Failure modes and mitigations
Ramp-up
Option prefix byte, enum indices, little-endian ordering, composite type ordering). PHP developers will have no Polkadot context.How can I help you explore Laravel packages today?