Skip to content

An Eptalights PHP CLI tool for exporting PHP (Zend) bytecode instructions in JSON format.

Notifications You must be signed in to change notification settings

eptalights/eptalights-code-extractor-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eptalights-code-extractor-php

An Eptalights PHP CLI tool for exporting PHP (Zend) bytecode instructions in JSON format.


Quick Start

# Clone the extractor repo
git clone https://github.com/eptalights/eptalights-code-extractor-php
cd eptalights-code-extractor-php

# Build Docker image
make docker-build

# Extract all PHP files from your project
make extract-all-using-docker \
  src-rootpath="/home/user/projects/myapp" \
  dst-rootpath="/home/user/projects/myapp_bytecode"

After running this, you’ll find the extracted bytecode JSON files inside: /home/user/projects/myapp_bytecode


Supported PHP Versions

  • v8.3.6 (supported)

Building

With Docker (recommended)

Requirements:

# Clone the repository
git clone https://github.com/eptalights/eptalights-code-extractor-php
cd eptalights-code-extractor-php

# Build the Docker image
make docker-build

# Open an interactive shell in the container
make docker-shell
cd /extractor

# Download PHP source
make download-php-src

# Build PHP from source
make build-php-src

# Build the Eptalights PHP CLI
make build-eptalights-code-extractor-php-cli

Or, build directly via Docker without entering the container:

make build-eptalights-code-extractor-php-cli-with-docker

Without Docker

Requirements:

# Clone the repository
git clone https://github.com/eptalights/eptalights-code-extractor-php
cd eptalights-code-extractor-php

# Download PHP source
make download-php-src

# Build PHP from source
make build-php-src

# Build the Eptalights PHP CLI
make build-eptalights-code-extractor-php-cli

Usage

Extract bytecode from a single file

cd eptalights-code-extractor-php

make extract-file \
  filepath="/home/user/projects/myapp/index.php" \
  src-rootpath="/home/user/projects/myapp" \
  dst-rootpath="/home/user/projects/myapp_bytecode"

Extract bytecode from all PHP source files in a directory

cd eptalights-code-extractor-php

make extract-all \
  src-rootpath="/home/user/projects/myapp" \
  dst-rootpath="/home/user/projects/myapp_bytecode"

Extract bytecode from all files using Docker

cd eptalights-code-extractor-php

make extract-all-using-docker \
  src-rootpath="/home/user/projects/myapp" \
  dst-rootpath="/home/user/projects/myapp_bytecode"

Extract bytecode from another project directory (without cd into extractor repo)

If your PHP project is at /home/user/projects/myapp but the extractor repo is at /home/user/tools/eptalights-code-extractor-php, you can run:

make -C /home/user/tools/eptalights-code-extractor-php extract-all-using-docker \
  src-rootpath="/home/user/projects/myapp" \
  dst-rootpath="/home/user/projects/myapp_bytecode"

Supported File Extensions

The extractor scans and processes the following file types:

  • .php
  • .phtml
  • .inc
  • .php3, .php4, .php5, .php7, .php8

About

An Eptalights PHP CLI tool for exporting PHP (Zend) bytecode instructions in JSON format.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors