Skip to content

Commit 444756a

Browse files
committed
adding readme
1 parent f25150c commit 444756a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# PHP Obfuscator
2+
3+
This is an "obfuscator" for PSR/OOp PHP code. Different from other obfuscators, which often use a (reversible) `eval()` based obfuscation, this tool actually [parses PHP](https://github.com/nikic/PHP-Parser), and obfuscates variable names, methods, etc. This means is can not be reversed by tools such as [UnPHP](http://www.unphp.net).
4+
5+
This library was written out of the need to obfuscate the source for a private library which for various reasons could not be shared without steps to protect the source from prying eyes. It is not technically feasible to "encrypt" PHP source code, while retaining the option to run it on a standard PHP runtime. Tools such as [Zend Guard](http://www.zend.com/products/guard) use run-time plugins, but even these offer no real security.
6+
7+
While this tool does not make PHP code impossible to read, it will make it significantly less legible.
8+
9+
It is compatible with PHP up to and including 5.5.
10+
11+
## Usage
12+
13+
After cloning this repository (`git clone https://github.com/naneau/php-obfuscator`), run the following command to obfuscate a directory of PHP files:
14+
15+
```bash
16+
./obfuscate obfuscate /input/directory /output/directory
17+
```
18+
19+
### Configuration
20+
21+
You may find that you'll need to prevent certain variables and methods from being renamed. In this case you can create a simple YAML configuration file
22+
23+
```yaml
24+
parameters:
25+
26+
# Ignore variable names
27+
obfuscator.node_visitor.scramble_variable.ignore:
28+
- foo
29+
- bar
30+
- baz
31+
32+
# Ignore certain methods names
33+
obfuscator.node_visitor.scramble_private_method.ignore:
34+
- foo
35+
- bar
36+
- baz
37+
```
38+
39+
You can run the obfuscator with a configuration file through
40+
41+
```bash
42+
./obfuscate obfuscate /input/directory /output/directory --config=/foo/bar/config.yml
43+
```

0 commit comments

Comments
 (0)