PHPackages                             gmajor/substrate-codec-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gmajor/substrate-codec-php

ActiveLibrary[API Development](/categories/api)

gmajor/substrate-codec-php
==========================

PHP SCALE Codec for Substrate - v2.0

v1.1.2(1y ago)820.8k↓50%6[1 issues](https://github.com/gmajor-encrypt/php-scale-codec/issues)2MITPHPPHP &gt;=8.0CI passing

Since Jul 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/gmajor-encrypt/php-scale-codec)[ Packagist](https://packagist.org/packages/gmajor/substrate-codec-php)[ RSS](/packages/gmajor-substrate-codec-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (12)Used By (2)

php-scale-codec
===============

[](#php-scale-codec)

[![PHP Version](https://camo.githubusercontent.com/5ed842996550cad148e16d3ad4738491b8319d2fbf7bba88eeeee0cb4bf9b736/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d373737626234)](https://php.net)[![License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

PHP implementation of the **SCALE (Simple Concatenated Aggregate Little-Endian)** codec used in Substrate-based blockchains like Polkadot, Kusama, and Substrate-native chains.

Features
--------

[](#features)

- ✅ Full SCALE codec implementation
- ✅ All primitive types (U8-U128, I8-I128, Bool, String)
- ✅ Compact integer encoding
- ✅ Compound types (Vec, Option, Tuple, Struct, Enum)
- ✅ Metadata v12-v15 support
- ✅ Extrinsic building and signing
- ✅ Event parsing
- ✅ polkadot.js compatible

Installation
------------

[](#installation)

```
composer require gmajor/substrate-codec-php
```

Requirements
------------

[](#requirements)

- PHP 8.2+
- ext-gmp (for large integer handling)
- ext-json
- ext-sodium

Quick Start
-----------

[](#quick-start)

### Basic Encoding/Decoding

[](#basic-encodingdecoding)

```
