PHPackages                             vlydev/cs2-masked-inspect - 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. vlydev/cs2-masked-inspect

ActiveLibrary

vlydev/cs2-masked-inspect
=========================

Encode and decode CS2 masked inspect links

v1.1.0(5d ago)063↓14.3%MITPHPPHP &gt;=8.2CI passing

Since Mar 16Pushed 5d agoCompare

[ Source](https://github.com/vlydev/cs2-masked-inspect-php)[ Packagist](https://packagist.org/packages/vlydev/cs2-masked-inspect)[ RSS](/packages/vlydev-cs2-masked-inspect/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

cs2-masked-inspect (PHP)
========================

[](#cs2-masked-inspect-php)

Pure PHP 8.2+ library for encoding and decoding CS2 masked inspect links — no runtime dependencies.

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

[](#installation)

```
composer require vlydev/cs2-masked-inspect
```

Usage
-----

[](#usage)

### Deserialize a CS2 inspect link

[](#deserialize-a-cs2-inspect-link)

```
use VlyDev\Steam\InspectLink;

// Accepts a full steam:// URL or a raw hex string
$item = InspectLink::deserialize(
    'steam://run/730//+csgo_econ_action_preview%20E3F3367440334DE2FBE4C345E0CBE0D3...'
);

echo $item->defindex;   // 7  (AK-47)
echo $item->paintindex; // 422
echo $item->paintseed;  // 922
echo $item->paintwear;  // ~0.04121
echo $item->itemid;     // 46876117973

foreach ($item->stickers as $s) {
    echo $s->stickerId; // 7436, 5144, 6970, 8069, 5592
}
```

### Serialize an item to a hex payload

[](#serialize-an-item-to-a-hex-payload)

```
use VlyDev\Steam\InspectLink;
use VlyDev\Steam\ItemPreviewData;

$data = new ItemPreviewData(
    defindex:   60,
    paintindex: 440,
    paintseed:  353,
    paintwear:  0.005411375779658556,
    rarity:     5,
);

$hex = InspectLink::serialize($data);
// 00183C20B803280538E9A3C5DD0340E102C246A0D1

$url = "steam://run/730//+csgo_econ_action_preview%20{$hex}";
```

### Item with stickers and keychains

[](#item-with-stickers-and-keychains)

```
use VlyDev\Steam\InspectLink;
use VlyDev\Steam\ItemPreviewData;
use VlyDev\Steam\Sticker;

$data = new ItemPreviewData(
    defindex:   7,
    paintindex: 422,
    paintseed:  922,
    paintwear:  0.04121,
    rarity:     3,
    quality:    4,
    stickers: [
        new Sticker(slot: 0, stickerId: 7436),
        new Sticker(slot: 1, stickerId: 5144, wear: 0.1),
    ],
);

$hex = InspectLink::serialize($data);
$decoded = InspectLink::deserialize($hex); // round-trip
```

---

Gen codes
---------

[](#gen-codes)

Gen codes are space-separated command strings used on CS2 community servers to spawn items.

Format:

```
!gen {defindex} {paintindex} {paintseed} {paintwear} [{s0_id} {s0_wear} ... {s4_id} {s4_wear}] [{kc_id} {kc_wear} ...]

```

- Stickers are always represented as 5 slot pairs (padded with `0 0` for empty slots)
- Keychains are appended without padding, only for present slots
- Float values have trailing zeros stripped (max 8 decimal places); `0.0` becomes `"0"`

### Generate a Steam inspect URL from parameters

[](#generate-a-steam-inspect-url-from-parameters)

```
use VlyDev\Steam\GenCode;

$url = GenCode::generate(
    defIndex:  7,
    paintIndex: 474,
    paintSeed:  306,
    paintWear:  0.22540508,
    rarity:     6,
);
// steam://rungame/730/76561202255233023/+csgo_econ_action_preview%200018...
```

### Convert an ItemPreviewData to a gen code

[](#convert-an-itempreviewdata-to-a-gen-code)

```
use VlyDev\Steam\GenCode;
use VlyDev\Steam\ItemPreviewData;
use VlyDev\Steam\Sticker;

$item = new ItemPreviewData(
    defindex:   7,
    paintindex: 474,
    paintseed:  306,
    paintwear:  0.22540508,
    stickers: [
        new Sticker(slot: 2, stickerId: 7203),
    ],
);

$code = GenCode::toGenCode($item);
// "!gen 7 474 306 0.22540508 0 0 0 0 7203 0 0 0 0 0"

$code = GenCode::toGenCode($item, '!g'); // custom prefix
```

### Parse a gen code string

[](#parse-a-gen-code-string)

```
use VlyDev\Steam\GenCode;

$item = GenCode::parseGenCode('!gen 7 474 306 0.22540508 0 0 0 0 7203 0 0 0 0 0');
echo $item->defindex;    // 7
echo $item->paintindex;  // 474
echo $item->paintseed;   // 306
echo $item->paintwear;   // 0.22540508

$item2 = GenCode::parseGenCode('7 474 306 0.22540508'); // prefix is optional
```

### Convert an existing inspect link directly to a gen code

[](#convert-an-existing-inspect-link-directly-to-a-gen-code)

```
$code = GenCode::genCodeFromLink('steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20001A...');
// "!gen 7 474 306 0.22540508"
```

---

Validation
----------

[](#validation)

Use `isMasked()` and `isClassic()` to detect the link type without attempting to decode it.

```
use VlyDev\Steam\InspectLink;

// New masked format (pure hex blob) — can be decoded offline
$maskedUrl = 'steam://run/730//+csgo_econ_action_preview%20E3F3...';
InspectLink::isMasked($maskedUrl);   // true
InspectLink::isClassic($maskedUrl);  // false

// Hybrid format (S/A/D prefix with hex proto after D) — also decodable offline
$hybridUrl = 'steam://rungame/730/.../+csgo_econ_action_preview%20S76561199323320483A50075495125D1101C4C4FCD4AB10...';
InspectLink::isMasked($hybridUrl);   // true
InspectLink::isClassic($hybridUrl);  // false

// Classic format — requires Steam Game Coordinator to fetch item info
$classicUrl = 'steam://rungame/730/.../+csgo_econ_action_preview%20S76561199842063946A49749521570D2751293026650298712';
InspectLink::isMasked($classicUrl);  // false
InspectLink::isClassic($classicUrl); // true
```

---

Validation rules
----------------

[](#validation-rules)

`deserialize()` enforces:

RuleLimitExceptionHex payload lengthmax 4,096 characters`InvalidArgumentException`Protobuf field countmax 100 per message`OverflowException``serialize()` enforces:

FieldConstraintException`paintwear``[0.0, 1.0]``InvalidArgumentException``customname`max 100 characters`InvalidArgumentException`---

How the format works
--------------------

[](#how-the-format-works)

Three URL formats are handled:

1. **New masked format** — pure hex blob after `csgo_econ_action_preview`:

    ```
    steam://run/730//+csgo_econ_action_preview%20

    ```
2. **Hybrid format** — old-style `S/A/D` prefix, but with a hex proto appended after `D` (instead of a decimal did):

    ```
    steam://rungame/730/.../+csgo_econ_action_preview%20SAD

    ```
3. **Classic format** — old-style `S/A/D` with a decimal did; requires Steam GC to resolve item details.

For formats 1 and 2 the library decodes the item offline. For format 3 only URL parsing is possible.

The hex blob (formats 1 and 2) has the following binary layout:

```
[key_byte] [proto_bytes XOR'd with key] [4-byte checksum XOR'd with key]

```

SectionSizeDescription`key_byte`1 byteXOR key. `0x00` = no obfuscation (tool links). Other values = native CS2 links.`proto_bytes`variable`CEconItemPreviewDataBlock` protobuf, each byte XOR'd with `key_byte`.`checksum`4 bytesBig-endian uint32, XOR'd with `key_byte`.### Checksum algorithm

[](#checksum-algorithm)

```
$buffer   = "\x00" . $protoBytes;
$crc      = crc32($buffer) & 0xFFFFFFFF;
$xored    = (($crc & 0xFFFF) ^ (strlen($protoBytes) * $crc)) & 0xFFFFFFFF;
$checksum = pack('N', $xored); // big-endian uint32
```

### `paintwear` encoding

[](#paintwear-encoding)

`paintwear` is stored as a `uint32` varint whose bit pattern is the IEEE 754 representation of a `float32`. The library handles this transparently — callers always work with PHP `float` values.

---

Proto field reference
---------------------

[](#proto-field-reference)

### CEconItemPreviewDataBlock

[](#ceconitempreviewdatablock)

FieldNumberTypeDescription`accountid`1uint32Steam account ID (often 0)`itemid`2uint64Item ID in the owner's inventory`defindex`3uint32Item definition index (weapon type)`paintindex`4uint32Skin paint index`rarity`5uint32Item rarity`quality`6uint32Item quality`paintwear`7uint32\*float32 reinterpreted as uint32`paintseed`8uint32Pattern seed (0–1000)`killeaterscoretype`9uint32StatTrak counter type`killeatervalue`10uint32StatTrak value`customname`11stringName tag`stickers`12repeated StickerApplied stickers`inventory`13uint32Inventory flags`origin`14uint32Origin`questid`15uint32Quest ID`dropreason`16uint32Drop reason`musicindex`17uint32Music kit index`entindex`18int32Entity index`petindex`19uint32Pet index`keychains`20repeated StickerApplied keychains### Sticker

[](#sticker)

FieldNumberTypeDescription`slot`1uint32Slot position`sticker_id`2uint32Sticker definition ID`wear`3float32Wear (fixed32)`scale`4float32Scale (fixed32)`rotation`5float32Rotation (fixed32)`tint_id`6uint32Tint`offset_x`7float32X offset (fixed32)`offset_y`8float32Y offset (fixed32)`offset_z`9float32Z offset (fixed32)`pattern`10uint32Pattern (keychains)---

Known test vectors
------------------

[](#known-test-vectors)

### Vector 1 — Native CS2 link (XOR key 0xE3)

[](#vector-1--native-cs2-link-xor-key-0xe3)

```
E3F3367440334DE2FBE4C345E0CBE0D3E7DB6943400AE0A379E481ECEBE2F36F
D9DE2BDB515EA6E30D74D981ECEBE3F37BCBDE640D475DA6E35EFCD881ECEBE3
F359D5DE37E9D75DA6436DD3DD81ECEBE3F366DCDE3F8F9BDDA69B43B6DE81EC
EBE3F33BC8DEBB1CA3DFA623F7DDDF8B71E293EBFD43382B

```

FieldValue`itemid``46876117973``defindex``7` (AK-47)`paintindex``422``paintseed``922``paintwear``≈ 0.04121``rarity``3``quality``4`sticker IDs`[7436, 5144, 6970, 8069, 5592]`### Vector 2 — Tool-generated link (key 0x00)

[](#vector-2--tool-generated-link-key-0x00)

```
new ItemPreviewData(defindex: 60, paintindex: 440, paintseed: 353,
                    paintwear: 0.005411375779658556, rarity: 5)
```

Expected hex:

```
00183C20B803280538E9A3C5DD0340E102C246A0D1

```

---

Running tests
-------------

[](#running-tests)

```
composer install
composer test
```

---

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome on [GitHub](https://github.com/vlydev/cs2-masked-inspect-php).

1. Fork the repository
2. Create a branch: `git checkout -b my-fix`
3. Make your changes and add tests
4. Ensure all tests pass: `composer test`
5. Open a Pull Request

All PRs require the CI checks to pass before merging.

---

Author
------

[](#author)

[VlyDev](https://github.com/vlydev) —

---

License
-------

[](#license)

MIT © [VlyDev](https://github.com/vlydev)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance99

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

5d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/101d5dc30b6dcc6122f15c83a22d9f1cdbe20e6e34d55cfa352de58d6a4d131b?d=identicon)[vladdnepr](/maintainers/vladdnepr)

---

Top Contributors

[![vlydev](https://avatars.githubusercontent.com/u/2308269?v=4)](https://github.com/vlydev "vlydev (7 commits)")

---

Tags

protobufsteaminspectcsgocs2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vlydev-cs2-masked-inspect/health.svg)

```
[![Health](https://phpackages.com/badges/vlydev-cs2-masked-inspect/health.svg)](https://phpackages.com/packages/vlydev-cs2-masked-inspect)
```

###  Alternatives

[protobuf-php/protobuf

PHP implementation of Google's Protocol Buffers

2631.4M14](/packages/protobuf-php-protobuf)[xpaw/php-source-query-class

PHP library to query and send RCON commands to servers based on "Source Engine Query" protocol

606186.1k6](/packages/xpaw-php-source-query-class)[twirp/twirp

PHP port of Twitch's Twirp RPC framework

159963.1k3](/packages/twirp-twirp)[nuwber/rabbitevents

The Nuwber RabbitEvents package

120510.8k2](/packages/nuwber-rabbitevents)[invisnik/laravel-steam-auth

Laravel Steam Auth

170160.2k1](/packages/invisnik-laravel-steam-auth)[oro/twig-inspector

Oro Twig Inspector adds the possibility to find twig templates and blocks used for rendering HTML pages faster during development

46519.8k10](/packages/oro-twig-inspector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
