PHPackages                             globus-studio/php-obfuscator - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. globus-studio/php-obfuscator

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

globus-studio/php-obfuscator
============================

A token-based PHP source code obfuscator with full support for PHP 8.1 through 8.5.

v1.0.0(1mo ago)2113↓66.7%3MITPHPPHP ^8.1CI passing

Since Apr 27Pushed 1mo ago14 watchersCompare

[ Source](https://github.com/GLOBUS-studio/PhpObfuscator)[ Packagist](https://packagist.org/packages/globus-studio/php-obfuscator)[ Docs](https://github.com/GLOBUS-studio/PhpObfuscator)[ RSS](/packages/globus-studio-php-obfuscator/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

PhpObfuscator
=============

[](#phpobfuscator)

[![CI](https://github.com/GLOBUS-studio/PhpObfuscator/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/GLOBUS-studio/PhpObfuscator/actions/workflows/ci.yml)[![Latest Release](https://camo.githubusercontent.com/3429954b175dc5a87715d36e4b9d3e0fc4ec252d049943ea1aee39de7c80d4e6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f474c4f4255532d73747564696f2f5068704f626675736361746f723f696e636c7564655f70726572656c656173657326736f72743d73656d766572)](https://github.com/GLOBUS-studio/PhpObfuscator/releases)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![Tested on PHP 8.1 - 8.5](https://camo.githubusercontent.com/5c0e2fbf662c24f3e1c6673d47f24daaf855d3a2e72c9f12a44f214e3a2f4d88/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e31253230253743253230382e32253230253743253230382e33253230253743253230382e34253230253743253230382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](.github/workflows/ci.yml)[![PHPUnit](https://camo.githubusercontent.com/f56ae38395368a88116d08c116af4a76d579136e38322ffd1de39394968599fb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746573746564253230776974682d504850556e69742d627269676874677265656e2e737667)](https://phpunit.de/)

A token-based PHP source code obfuscator. Renames identifiers, encodes string literals and minifies whitespace, all driven by PHP's own tokenizer rather than brittle regular expressions, so the transformed code keeps its original runtime semantics on every supported PHP version.

The obfuscator is fully tested on PHP 8.1, 8.2, 8.3, 8.4 and 8.5 in CI.

Why another obfuscator?
-----------------------

[](#why-another-obfuscator)

Most PHP obfuscators on the open web rely on regular expressions. They break on namespaced code, on complex string interpolation, on constructor property promotion and on anything that does not fit a simple textual pattern. This library walks the official `PhpToken` stream and rewrites identifiers using the same lexical context the engine itself uses, which makes the result predictable and safe to ship.

Features
--------

[](#features)

- Token-based identifier rewriting (variables, functions, classes, interfaces, traits, enums, methods, properties, class and global constants).
- Constructor property promotion, `readonly`, `enum`, `match`, arrow functions, nullsafe operator, named arguments and attributes are all recognised.
- Optional Base64 encoding of string literals (skipped automatically inside constant expressions where PHP requires literal values).
- Optional comment stripping and whitespace minification driven by a second tokenizer pass, so the output is guaranteed to remain parseable.
- Optional `eval(base64_decode(...))` wrapping for an extra layer of protection.
- Deterministic PRNG seed for reproducible builds.
- Inspection of the rename table via `getNameMap()`.
- Bundled `php-obfuscate` CLI binary.

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

[](#installation)

```
composer require globus-studio/php-obfuscator
```

Quick start
-----------

[](#quick-start)

```
