{"id":13766214,"url":"https://github.com/pH-7/Obfuscator-Class","last_synced_at":"2025-05-10T21:33:12.283Z","repository":{"id":41247859,"uuid":"66738929","full_name":"pH-7/Obfuscator-Class","owner":"pH-7","description":":man_technologist: Simple and effective Obfuscator PHP class (this is not a stupid base64 encoding script, but a real and effective obfuscation script)","archived":false,"fork":false,"pushed_at":"2021-05-10T09:08:04.000Z","size":52,"stargazers_count":372,"open_issues_count":9,"forks_count":144,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-13T07:52:04.274Z","etag":null,"topics":["code-obfuscator","encode","encryption","hide-code","obfuscate","obfuscate-code","obfuscation","obfuscator","php","php-encoder","php-encryption","php-obfuscation","php-obfuscator"],"latest_commit_sha":null,"homepage":"http://github.com/pH-7/Obfuscator-Class","language":"PHP","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/pH-7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-27T22:50:46.000Z","updated_at":"2025-04-07T17:22:24.000Z","dependencies_parsed_at":"2022-07-12T23:10:34.220Z","dependency_job_id":null,"html_url":"https://github.com/pH-7/Obfuscator-Class","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FObfuscator-Class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FObfuscator-Class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FObfuscator-Class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FObfuscator-Class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pH-7","download_url":"https://codeload.github.com/pH-7/Obfuscator-Class/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253486246,"owners_count":21916134,"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","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","encode","encryption","hide-code","obfuscate","obfuscate-code","obfuscation","obfuscator","php","php-encoder","php-encryption","php-obfuscation","php-obfuscator"],"created_at":"2024-08-03T16:00:52.686Z","updated_at":"2025-05-10T21:33:12.010Z","avatar_url":"https://github.com/pH-7.png","language":"PHP","readme":"# 🔐 PHP Obfuscator\n\nSimple, easy-to-use and effective Obfuscator PHP class.\n\n**Not just a stupid `base64 encoding` script, but a real and effective obfuscation script.**\n\nIdeal to obfuscate some critical pieces of your software such as licensing verification functions.\n\n\n## 👓 Overview \n\nIf you want to keep your open source code private, but working on all Web hosting, this **Obfuscator** class is THE obfuscator you need!\n\nNot easily readable by developers (unless they are ready to spend lot of time). It will definitely discourage them! :smiley:\n\n\n## 📓 Usage\n\n### Take out `\u003cphp` before to obfuscate\n\nFirst of all, please make sure to strip the PHP open/close tags `\u003c?php` and `?\u003e`\n\nIf you specify code to be obfuscated with `\u003c?php`, you will get a critical syntax error.\n\n\n### Example 1\n\n```php\n\u003c?php\nrequire 'src/Obfuscator.php';\n\n$sData = \u003c\u003c\u003c'DATA'\n    echo 'This is my PHP code, can be class class, interface, trait, etc. in PHP 5, 7, 7.2, 7.4 and higher.';\nDATA;\n\n$sObfusationData = new Obfuscator($sData, 'Class/Code NAME');\nfile_put_contents('my_obfuscated_data.php', '\u003c?php ' . \"\\r\\n\" . $sObfusationData);\n```\n\nRun the `my_obfuscated_data.php` freshly created, and you will see:\n\u003e This is my PHP code, can be class class, interface, trait, etc. in PHP 5, 7, 7.2, 7.4 and higher.\n\nIf you open the file, you will see that your code is totally hidden (obfuscated).\n\n\n### Example 2\n\n```php\n\u003c?php\nrequire 'src/Obfuscator.php';\n\n$sData = \u003c\u003c\u003c'DATA'\n    $hour = date('H');\n\n    echo 'The hour (of the server) is ' . date('H:m');\n    echo ', and will give the following message:\u003cbr\u003e\u003cbr\u003e';\n\n    if ($hour \u003c 10) {\n        echo 'Have a good morning!';\n    } elseif ($hour \u003c 20) {\n        echo 'Have a good day!';\n    } else {\n        echo 'Have a good night! zZz z';\n    }\nDATA;\n\n$sObfusationData = new Obfuscator($sData, 'Give a name to the piece of code you want to obfuscate');\nfile_put_contents('obfuscated_code.php', '\u003c?php ' . \"\\r\\n\" . $sObfusationData);\n```\n\nRun `obfuscated_code.php` file and you will see something like below:\n\n**The hour (of the server) is 19, and will give the following message: Have a good day!**\n\n\n### Example 3\n\n```php\n\u003c?php\nrequire 'src/Obfuscator.php';\n\n$filename = 'myphpfile'; // A PHP filename (without .php) that you want to obfuscate\n\n$sData = file_get_contents($filename . '.php');\n$sData = str_replace(array('\u003c?php', '\u003c?', '?\u003e'), '', $sData); // We strip the open/close PHP tags\n$sObfusationData = new Obfuscator($sData, 'Class/Code NAME');\nfile_put_contents($filename . '_obfuscated.php', '\u003c?php ' . \"\\r\\n\" . $sObfusationData);\n```\n\n\n## ⚙ Requirement\n\n* PHP 5.3 or higher (works also with PHP 7.2, ..., 7.4, and beyond!)\n\n\n## 📖 History\n\nI began to create this obfuscation tool in early 2014 for my own needs, especially for pH7CMSPro that had a licensing file which was unlocking some premium features if a valid license key was purchased by a client.\nIn summer 2016, the Pro version of [pH7CMS](https://github.com/pH7Software/pH7-Social-Dating-CMS) was discontinued, and realize there was no reason to keep this project private and I wanted to share it with others (hoping it will help them and save their time!).\n\nFeel free to add your improvements in it by forking the repo and creating a new PR. I will be pleased to review your contribution!\n\n\nFYI, in 3 years' time, I never found my obfuscated code unobfuscated (and the software was downloaded by over 50,000 users). You can be quite confident then.\n\n\n## 🤔 Who Am I?\n\nI'm **[Pierre-Henry Soria][author-url]**, Software Developer, love learning new things every single day and also passionate about e-businesses and e-marketing.\n\n[![@phenrysay][twitter-image]][twitter-url]\n\n\n## 📧 Wanna Contact Me?\n\nYou can email me at: **pierrehenrysoria+github [[AT]] gmail [[D0T]] com** 🤗\n\n\n## ⚖️ License\n\nGenerously distributed under [MIT License][license-url]. See LICENSE.txt file for further information.\n\n\n\u003c!-- GitHub's Markdown reference links --\u003e\n[author-url]: https://ph7.me\n[license-url]: https://opensource.org/licenses/MIT\n[twitter-image]: https://img.shields.io/twitter/url/https/shields.io.svg?style=social\n[twitter-url]: https://twitter.com/phenrysay\n","funding_links":[],"categories":["Projects"],"sub_categories":["PHP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FpH-7%2FObfuscator-Class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FpH-7%2FObfuscator-Class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FpH-7%2FObfuscator-Class/lists"}