{"id":21340247,"url":"https://github.com/mnestorov/php-obfuscator","last_synced_at":"2025-08-12T10:13:40.434Z","repository":{"id":162734039,"uuid":"637192357","full_name":"mnestorov/php-obfuscator","owner":"mnestorov","description":"PHP Obfuscator is a command-line tool build with Python to obfuscate PHP source code files.","archived":false,"fork":false,"pushed_at":"2024-11-13T22:26:31.000Z","size":526,"stargazers_count":51,"open_issues_count":2,"forks_count":16,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T20:51:29.683Z","etag":null,"topics":["code-obfuscator","code-protection","copyright-protection","criptography","intelectualproperty","obfuscator","obfuscator-php","obfuscator-python","obfuscatorfree","php","php-obfuscation","php-obfuscator","python","python-script"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnestorov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mnestorov"}},"created_at":"2023-05-06T19:43:49.000Z","updated_at":"2025-04-01T23:29:23.000Z","dependencies_parsed_at":"2023-12-13T11:37:18.179Z","dependency_job_id":"29134196-64a9-4d9c-821e-0928586207fc","html_url":"https://github.com/mnestorov/php-obfuscator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mnestorov/php-obfuscator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fphp-obfuscator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fphp-obfuscator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fphp-obfuscator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fphp-obfuscator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnestorov","download_url":"https://codeload.github.com/mnestorov/php-obfuscator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fphp-obfuscator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270041538,"owners_count":24516868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-obfuscator","code-protection","copyright-protection","criptography","intelectualproperty","obfuscator","obfuscator-php","obfuscator-python","obfuscatorfree","php","php-obfuscation","php-obfuscator","python","python-script"],"created_at":"2024-11-22T00:49:50.099Z","updated_at":"2025-08-12T10:13:40.404Z","avatar_url":"https://github.com/mnestorov.png","language":"Python","readme":"![PHP_Obfuscator](images/php-obfuscator.png)\n\n# PHP Obfuscator\n\n[![Licence](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=for-the-badge)](./LICENSE)\n\n## Support The Project\n\nYour support is greatly appreciated and will help ensure all of the projects continued development and improvement. Thank you for being a part of the community!\nYou can send me money on Revolut by following this link: https://revolut.me/mnestorovv\n\n---\n\n## Overview\n\nPHP Obfuscator is a command-line tool build with Python to obfuscate PHP source code files using [YAK Pro](https://github.com/pk-fr/yakpro-po) and [PHP-Parser](https://github.com/nikic/PHP-Parser/tree/4.x/) php libraries. \n\nThe tool aims to protect the intellectual property of your PHP project by making it more difficult for others to understand or reverse-engineer your code. \n\nThe tool can be used to obfuscate **single files**, **multiple files**, or an **entire project directory**.\n\n## Example\n\n### Before\n\n**_app/Users.php_**\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse Illuminate\\Contracts\\Auth\\MustVerifyEmail;\nuse Illuminate\\Foundation\\Auth\\User as Authenticatable;\nuse Illuminate\\Notifications\\Notifiable;\n\nclass User extends Authenticatable\n{\n    use Notifiable;\n\n    /**\n     * The attributes that are mass assignable.\n     *\n     * @var array\n     */\n    protected $fillable = [\n        'username', 'email', 'password', 'background_color', 'text_color'\n    ];\n\n    /**\n     * The attributes that should be hidden for arrays.\n     *\n     * @var array\n     */\n    protected $hidden = [\n        'password', 'remember_token',\n    ];\n\n    public function links()\n    {\n        return $this-\u003ehasMany(Link::class);\n    }\n\n    public function visits()\n    {\n        return $this-\u003ehasManyThrough(Visit::class, Link::class);\n    }\n\n    public function getRouteKeyName() {\n        return 'username';\n    }\n\n}\n\n```\n\n### After\n\n**_app/Users.php_**\n\n```php\n\u003c?php\n namespace App; use Illuminate\\Contracts\\Auth\\MustVerifyEmail; use Illuminate\\Foundation\\Auth\\User as Authenticatable; use Illuminate\\Notifications\\Notifiable; class User extends Authenticatable { use Notifiable; protected $fillable = array(\"\\165\\163\\145\\162\\x6e\\141\\155\\x65\", \"\\x65\\x6d\\x61\\x69\\x6c\", \"\\x70\\x61\\163\\x73\\167\\157\\162\\x64\", \"\\x62\\x61\\143\\x6b\\147\\x72\\x6f\\x75\\156\\144\\137\\x63\\157\\154\\157\\x72\", \"\\164\\145\\x78\\x74\\x5f\\143\\157\\x6c\\x6f\\162\"); protected $hidden = array(\"\\160\\141\\163\\x73\\167\\x6f\\x72\\144\", \"\\x72\\145\\x6d\\145\\155\\142\\x65\\x72\\137\\164\\157\\x6b\\145\\156\"); public function links() { return $this-\u003ehasMany(Link::class); } public function visits() { return $this-\u003ehasManyThrough(Visit::class, Link::class); } public function getRouteKeyName() { return \"\\x75\\163\\145\\162\\x6e\\x61\\x6d\\145\"; } }\n```\n\n## Requirements\n\n- Python 3.6+\n- PHP-Parser (PHP library)\n- YAK Pro - Php Obfuscator (PHP library)\n\n## Installation\n\n1. Clone the repository\n\n```\ngit clone https://github.com/your-github-repo/php-obfuscator.git\n```\n\n2. Change to the project directory\n\n```\ncd php-obfuscator\n```\n\n3. Install YAK Pro - Php Obfuscator\n\nYou need to install this in to the project directory **_php-obfuscator_**\n\n```\ngit clone https://github.com/pk-fr/yakpro-po.git\n```\n\nAfter that, you need to configure the package from `yakpro-po.cnf` in to the **_php-obfuscator \u003e yakpro-po_** folder.\n\n**Recommended settings for the YAK Pro configuration:**\n\n```php\n// Allowed modes are: 'PREFER_PHP7', 'PREFER_PHP5', 'ONLY_PHP7', 'ONLY_PHP5'\n$conf-\u003eparser_mode = 'PREFER_PHP7'; \n\n$conf-\u003eobfuscate_constant_name = false;         \n$conf-\u003eobfuscate_variable_name = false;        \n$conf-\u003eobfuscate_function_name = false;        \n$conf-\u003eobfuscate_class_name = false;         \n$conf-\u003eobfuscate_interface_name = false;         \n$conf-\u003eobfuscate_trait_name = false;         \n$conf-\u003eobfuscate_class_constant_name = false;        \n$conf-\u003eobfuscate_property_name = false;        \n$conf-\u003eobfuscate_method_name = false;         \n$conf-\u003eobfuscate_namespace_name = false;         \n$conf-\u003eobfuscate_label_name = false;    \n\n// User comment to insert inside each obfuscated file\n$conf-\u003euser_comment = false;         \n```     \n\n4. Install PHP-Parser\n\nYou need to install this in to the **yakpro-po** directory in to the project directory **_php-obfuscator \u003e yakpro-po_**\n\n```\ngit clone https://github.com/nikic/PHP-Parser.git\n```\n5. Install the required Python packages\n\n**From the project directory, you need to run this command:**\n\n```\npip install -r requirements.txt\n```\n\n## Usage\n\n:warning: **Important:** The paths specified in `config.py` (especially YAKPRO) are correct and point to the YakPro-Po obfuscator on your system. \n\n1. Ensure you are in the project directory.\n2. Run the script\n\n```\npython main.py\n```\n\nor\n\n```\nbash start.sh\n```\n\n**Note:** Don't forget to change the path to the script in to the `start.sh` bash file.\n\n3. Follow the prompts to configure the obfuscation settings, including:\n    - Mode (single file, multiple files, or entire project directory)\n    - Output directory path\n    - File or directory paths to exclude\n    - Whether to create backups of original PHP files\n    - Choose from different obfuscation options (e.g., obfuscating variable names, function names, or class names) or combine multiple options\n\n4. After the obfuscation process is completed, you can find the obfuscated files in the specified output directory.\n\n## Used Libraries\n\n### Python\n\n- **os**, **sys**, **shutil**, and **re** - standard Python libraries for working with the file system and regular expressions\n- **logging** - standard Python library for logging\n- **concurrent.futures** - standard Python library for parallel processing\n- **tqdm** - external library for progress bars\n\n### PHP\n\n- [YAK Pro - a PHP library for obfuscating PHP code](https://github.com/pk-fr/yakpro-po)\n- [PHP-Parser - a PHP library to parse and traverse PHP code](https://github.com/nikic/PHP-Parser/tree/4.x/)\n\n## Troubleshooting\n\nIf you encounter issues after obfuscating your PHP project, you may need to revert your files to the original (non-obfuscated) versions and reevaluate your obfuscation strategy. Always keep backups of your original code before applying obfuscation, as it can be difficult or impossible to reverse the process and recover the original code.\n\n## TODOs\n\n- [x] **_Custom obfuscation options:_** ~~Allow users to choose from different obfuscation options (e.g., obfuscating variable names, function names, or class names) or combine multiple options.~~\n- [x] **_Preserve original file structure:_** ~~When obfuscating an entire project directory, recreate the original directory structure in the output folder, maintaining the same hierarchy~~.\n- **_File filters:_** Add filters to include or exclude specific files based on their names or extensions.\n- **_Command-line arguments:_** Implement command-line argument parsing to allow users to run the script with different configurations without manually editing the code.\n\n## Support The Project\n\nIf you find this script helpful and would like to support its development and maintenance, please consider the following options:\n\n- **_Star the repository_**: If you're using this script from a GitHub repository, please give the project a star on GitHub. This helps others discover the project and shows your appreciation for the work done.\n\n- **_Share your feedback_**: Your feedback, suggestions, and feature requests are invaluable to the project's growth. Please open issues on the GitHub repository or contact the author directly to provide your input.\n\n- **_Contribute_**: You can contribute to the project by submitting pull requests with bug fixes, improvements, or new features. Make sure to follow the project's coding style and guidelines when making changes.\n\n- **_Spread the word_**: Share the project with your friends, colleagues, and social media networks to help others benefit from the script as well.\n\n- **_Donate_**: Show your appreciation with a small donation. Your support will help me maintain and enhance the script. Every little bit helps, and your donation will make a big difference in my ability to keep this project alive and thriving.\n\nYour support is greatly appreciated and will help ensure all of the projects continued development and improvement. Thank you for being a part of the community!\nYou can send me money on Revolut by following this link: https://revolut.me/mnestorovv\n\n---\n\n## License\n\nThis project is released under the MIT License.\n","funding_links":["https://github.com/sponsors/mnestorov"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Fphp-obfuscator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnestorov%2Fphp-obfuscator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Fphp-obfuscator/lists"}