PHPackages                             brstoker/pe-version-reader - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. brstoker/pe-version-reader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

brstoker/pe-version-reader
==========================

Extract version info from Windows PE files (.exe, .dll, .sys) and archives (.zip, .tar.gz) on any OS. No WinAPI required.

00PHP

Since Mar 31Pushed 3mo agoCompare

[ Source](https://github.com/BrStoker/pe-version-reader)[ Packagist](https://packagist.org/packages/brstoker/pe-version-reader)[ RSS](/packages/brstoker-pe-version-reader/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PE Version Reader
=================

[](#pe-version-reader)

A cross-platform Laravel package for extracting version information from Windows PE files (`.exe`, `.dll`, `.sys`) and archives (`.zip`, `.tar.gz`, `.rar`, `.7z`). Works on Linux, macOS, and Windows without WinAPI.

---

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12
- `ext-zip`
- `ext-phar`

### Optional (for archive formats)

[](#optional-for-archive-formats)

FormatRequirement`.zip``ext-zip` (included in PHP by default)`.tar.gz``ext-phar` (included in PHP by default)`.rar``unrar` binary`.7z``7z` / `7za` binary#### Installing binaries

[](#installing-binaries)

**Linux (Debian/Ubuntu)**

```
apt install unrar p7zip-full
```

**macOS**

```
brew install rar p7zip
```

**Windows**

Download and install [WinRAR](https://www.rarlab.com/download.htm) and [7-Zip](https://www.7-zip.org/download.html). Make sure their directories are added to `PATH`, or the package will attempt to find them at their default installation paths automatically.

---

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

[](#installation)

```
composer require vendor/pe-version-reader
```

Laravel will auto-discover the service provider via package auto-discovery.

If auto-discovery is disabled, register the provider manually in `bootstrap/providers.php`:

```
Brstoker\PeVersionReader\PeVersionReaderServiceProvider::class,
```

---

Usage
-----

[](#usage)

### Basic — auto-detect file type

[](#basic--auto-detect-file-type)

```
use Brstoker\PeVersionReader\PeVersionReader;

$reader = app(PeVersionReader::class);

$info = $reader->read('/path/to/filename.zip');
$info = $reader->read('/path/to/filename.exe');
$info = $reader->read('/path/to/library.dll');
$info = $reader->read('/path/to/driver.sys');
```

### Explicit methods

[](#explicit-methods)

```
// PE file directly
$info = $reader->readExe('/path/to/filename.exe');

// Archive — looks for a PE file matching the archive name in the archive root
$info = $reader->readZip('/path/to/filename.zip');
```

### Working with the result

[](#working-with-the-result)

```
$info = $reader->read('/path/to/filename.zip');

if ($info === null) {
    // PE file with matching name was not found inside the archive
}

// Version strings
echo $info->fileVersion;      // "1.0.39.0"
echo $info->productVersion;   // "1.0.39"

// Version parts
echo $info->fileMajor;   // 1
echo $info->fileMinor;   // 0
echo $info->fileBuild;   // 39
echo $info->filePatch;   // 0

echo $info->productMajor;  // 1
echo $info->productMinor;  // 0
echo $info->productBuild;  // 39
echo $info->productPatch;  // 0

// Metadata
echo $info->companyName;      // "Acme Corp"
echo $info->productName;      // "filename"
echo $info->fileDescription;  // "filename updater"
echo $info->originalFilename; // "filename.exe"
echo $info->internalName;     // "filename"
echo $info->legalCopyright;   // "Copyright (C) 2026"
echo $info->comments;         // null

// Full array
$info->toArray();
```

`toArray()` returns:

```
[
    'file_version'    => '1.0.39.0',
    'product_version' => '1.0.39',

    'file_version_parts' => [
        'major' => 1,
        'minor' => 0,
        'build' => 39,
        'patch' => 0,
    ],

    'product_version_parts' => [
        'major' => 1,
        'minor' => 0,
        'build' => 39,
        'patch' => 0,
    ],

    'company_name'      => 'Acme Corp',
    'product_name'      => 'filename',
    'file_description'  => 'filename updater',
    'original_filename' => 'filename.exe',
    'internal_name'     => 'filename',
    'legal_copyright'   => 'Copyright (C) 2026',
    'comments'          => null,
]
```

---

How it works
------------

[](#how-it-works)

### PE files (.exe, .dll, .sys)

[](#pe-files-exe-dll-sys)

The package reads the binary file directly and locates the `VS_VERSION_INFO` resource embedded in the PE format. Version numbers are extracted from the `VS_FIXEDFILEINFO` structure, and string fields (company name, product name, etc.) are parsed from the `StringFileInfo` block. No WinAPI calls are made — the parser works entirely in pure PHP on any OS.

### Archives (.zip, .tar.gz)

[](#archives-zip-targz)

The package looks for a PE file in the **root of the archive** whose name (without extension) matches the archive name. For example, `filename.zip` must contain `filename.exe`, `filename.dll`, or `filename.sys` at the root level. Matching is case-insensitive. Once found, the file is extracted to a temporary directory, parsed, and the temp directory is cleaned up automatically.

### Archives (.rar, .7z)

[](#archives-rar-7z)

Same name-matching logic applies. Extraction is handled by shelling out to `unrar` (for `.rar`) or `7z` / `7za` (for `.7z`). The package auto-detects the binary location, including default installation paths on Windows (`C:\Program Files\WinRAR\`, `C:\Program Files\7-Zip\`).

---

ExceptionWhen`InvalidArgumentException`Unsupported file extension passed to `read()``FileNotFoundException`File does not exist at the given path`RuntimeException`Archive cannot be opened or extraction failed`UnsupportedFormatException`Required binary not found (unrar, 7z)---

Supported formats summary
-------------------------

[](#supported-formats-summary)

FormatDriverExternal dependency`.exe` `.dll` `.sys`Pure PHP PE parserNone`.zip``ext-zip`None`.tar.gz``ext-phar`None`.rar``unrar` shell`unrar` binary`.7z``7z` shell`7z` / `7za` binary---

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance55

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1683f13a57360d9372d58345d5f5a68f899662e48c13e5a7a3cb18daae0c7c66?d=identicon)[BrStoker](/maintainers/BrStoker)

---

Top Contributors

[![BrStoker](https://avatars.githubusercontent.com/u/39189388?v=4)](https://github.com/BrStoker "BrStoker (2 commits)")

### Embed Badge

![Health badge](/badges/brstoker-pe-version-reader/health.svg)

```
[![Health](https://phpackages.com/badges/brstoker-pe-version-reader/health.svg)](https://phpackages.com/packages/brstoker-pe-version-reader)
```

###  Alternatives

[nlp-tools/nlp-tools

NlpTools is a set of php 5.3+ classes for beginner to semi advanced natural language processing work.

764664.2k5](/packages/nlp-tools-nlp-tools)[vrana/jush

JUSH - JavaScript Syntax Highlighter

282.7M11](/packages/vrana-jush)[contentful/rich-text

Utilities for the Contentful Rich Text

123.5M3](/packages/contentful-rich-text)[arispati/emoji-remover

PHP library that remove an emoji from text

29363.1k](/packages/arispati-emoji-remover)[hhennes/module-cms

Add canonical tag to magento 2 cms pages

1533.9k](/packages/hhennes-module-cms)

PHPackages © 2026

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