Skip to content
Security Runs offline

PHP Source Encoder / Obfuscator

Obfuscate PHP by stripping comments and renaming identifiers, or encrypt it with real AES-256-GCM - all client-side.

Mode

Input

0 chars

Output

0 chars
Ctrl

Questions

Does the "Rename functions & classes" option ever break my code?

It can, which is why it defaults to off. It is a whole-file, name-matching heuristic: it renames every bareword occurrence of a declared function/class/interface/trait name, consistently, at the declaration and at call sites. It cannot see through dynamic dispatch - calling a function by a string held in a variable, invoking a variable that holds a callable, instantiating a class whose name is stored in a variable (`new $className()`), or anything reached via Reflection. Leave it off whenever your code uses any of those.

Does "Encrypt" actually protect my source from someone who can run the file?

No - this is source packaging / obfuscation-at-rest, not DRM. The generated PHP still needs the secret key at runtime to decrypt and run your code, and anyone with real access to the PHP process that includes this file can, with effort, recover the decrypted source; encryption-at-rest cannot prevent that. If you embed the secret directly in the file instead of reading it from an environment variable, protection is weaker still, since anyone who can read the file can read the key right next to it. For real, professional PHP source protection, use a dedicated commercial product such as ionCube Encoder or SourceGuardian, which protect at the opcode level rather than wrapping source text.

What PHP syntax does the obfuscator's tokenizer actually understand?

Its own from-scratch scanner: single- and double-quoted strings (including `$var`, `$var[index]`, `$var->prop`, and `{$expr}` interpolation), heredoc/nowdoc (including the PHP 7.3+ flexible indented closing marker), both comment forms (which correctly stop early at a `?>` closing tag, a real PHP quirk), PHP 8 attributes, and the `<?php`/`<?=` tag pair. It never renames superglobals, `$this`, magic methods (anything starting with `__`), namespace declarations, or `use` imports. Class property declarations and constructor-promoted parameters are also always left alone, since PHP accesses a property elsewhere as a bareword `$this->name` that this tool cannot safely rewrite in sync.

Where does the auto-generated secret get stored, and can I get it back later?

Nowhere - it is 32 random bytes from the browser's crypto.getRandomValues, shown to you as 64 hex characters in a comment inside the generated PHP (and in the Secret field if you press Generate) purely so you can save it yourself. DevTools never stores it, so if you lose it before setting it as your environment variable or copying it elsewhere, the encrypted file can never be decrypted again - there is no recovery path.

Open JavaScript Obfuscator

JavaScript Obfuscator

Compact and lightly obfuscate JavaScript entirely in your browser - no code ever leaves your machine.

Security
Open Code Formatter

Code Formatter

Format or conservatively minify HTML, CSS, JavaScript, JSON, XML, SQL and PHP, one tool for all seven.

Developer
Open bcrypt Generator

bcrypt Generator

Hash a password with bcrypt, or verify one against a hash.

Hash & IDs