{"id":13540302,"url":"https://github.com/pk-fr/yakpro-po","last_synced_at":"2025-10-24T19:39:20.666Z","repository":{"id":30718035,"uuid":"34274229","full_name":"pk-fr/yakpro-po","owner":"pk-fr","description":"YAK Pro - Php Obfuscator","archived":false,"fork":false,"pushed_at":"2025-03-10T16:42:40.000Z","size":170,"stargazers_count":1394,"open_issues_count":23,"forks_count":379,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-04-13T17:46:37.264Z","etag":null,"topics":["obfuscation","obfuscator","php","php-obfuscator"],"latest_commit_sha":null,"homepage":"http://www.php-obfuscator.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pk-fr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2015-04-20T17:06:03.000Z","updated_at":"2025-04-04T13:09:22.000Z","dependencies_parsed_at":"2024-01-25T20:04:50.481Z","dependency_job_id":"adfa0ac9-1ff6-4bc6-9b5f-f75b94caf2ab","html_url":"https://github.com/pk-fr/yakpro-po","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pk-fr%2Fyakpro-po","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pk-fr%2Fyakpro-po/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pk-fr%2Fyakpro-po/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pk-fr%2Fyakpro-po/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pk-fr","download_url":"https://codeload.github.com/pk-fr/yakpro-po/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254170059,"owners_count":22026219,"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":["obfuscation","obfuscator","php","php-obfuscator"],"created_at":"2024-08-01T09:01:46.104Z","updated_at":"2025-10-24T19:39:20.564Z","avatar_url":"https://github.com/pk-fr.png","language":"PHP","funding_links":[],"categories":["Projects","\u003ca id=\"783f861b9f822127dba99acb55687cbb\"\u003e\u003c/a\u003e工具"],"sub_categories":["PHP","\u003ca id=\"85bb0c28850ffa2b4fd44f70816db306\"\u003e\u003c/a\u003e混淆器\u0026\u0026Obfuscate"],"readme":"[Cette page en Français](https://github.com/pk-fr/yakpro-po/blob/master/locale/fr/README.md)\n\n# YAK Pro - Php Obfuscator\n\n**YAK Pro** stands for **Y**et **A**nother **K**iller **Pro**duct.\n\nFree, Open Source, Published under the MIT License.\n\nThis tool parses php with the best existing php parser [PHP-Parser 4.x](https://github.com/nikic/PHP-Parser/tree/4.x/),\nwhich is an awesome php parsing library written by [nikic](https://github.com/nikic).\n\nYou just have to download the zip archive and uncompress it under the PHP-Parser subdirectory,\nor make a git clone ...\n\n### Warning:  \n    yakpro-po 2.x works on PhpParser 4.x   \n    it will run on php \u003e= 7.0, obfuscating code for php 5.2 to php 7.3   \n    \n    If you are running php 5.3 or higher,  \n    Please use unsupported [yakpro-po 1.x](https://github.com/pk-fr/yakpro-po/tree/1.x) which works on 1.x branch of PhpParser.   \n    \n\n\nThe yakpro-po.cnf self-documented file contains many configuration options!\nTake a look at it!\n\nDemo : [yakpro-po demo](https://www.php-obfuscator.com/?demo).\n\nPrerequisites:  php 7.0 or higher, [PHP-Parser 4.x](https://github.com/nikic/PHP-Parser/tree/4.x/).\n\nNote: This tool has been written in order to obfuscate pure php sources.\nit is not intended to be used with html and embeded php inside \n(use at your own risks...you may try to deactivate statements shuffling...).\nYou can still embed html within php using the echo \u003c\u003c\u003cEND ... END; syntax!\n\n## What is Php Obfuscation?\n\nWhen you have a php project you want to distribute, as php is a script interpretor,\nyou distribute also all the sources of your software!\n\nYou may want, for any reason, that other people do not understand, modify, or adapt your software.\n\nAs your software must be understandable by the **php runtime**, but needs to be very difficult\nto understand by human people, obfuscation is a very good way to achieve this goal.\n\n### YAK Pro - Php Obfuscator Obfuscation Main Features:\n\n- Removes all comments, indentation, and generates a single line program file.\n- Obfuscates **if, else, elseif, for, while, do while** by replacing them with **if goto** statements.\n- Obfuscates string literals.\n- Scrambles names for:\n  - Variables, Functions, Constants.\n  - Classes, Interfaces, Traits.\n  - Properties, Methods.\n  - Namespaces.\n  - Labels.\n- Shuffles Statements.\n\n- Recursivly obfuscates a project's directory.\n- Makefile like, timestamps based mechanism, to re-obfuscate only files that were changed since last obfuscation.\n- Many configuration options that let you have **full control** of what is obfuscated within your project!\n\n\n### Why Yet Another Php Obfuscator?\nI began testing some already existing php obfuscation tools, but I did'nt find one that was\nfitting all my needs.\nI wanted a **simple** command line tool, based on a **highly customisable** config file, that would be able to:\n- Be fast and re-obfuscate only files that were changed based on timestamps of files.\n- Preserve some files and/or directories from obfuscation.\n- Not include in the obfuscated target, some files/directories that are present on the source project.\n- Accept lists of names and/or name prefixes to not obfuscate.\n\nSo I started to write this tool.\nVersion 1.0 has been written within a few days...\n\n\n## Setup:\n    Note: This setup is also valid for Windows 10 Anniversary with bash installed...  \n    1. Prerequisites: git and php-cli (command line interface) packages. \n       on ubuntu: (adapt according your linux distribution) \n       # apt install git \n       # apt install php-cli\n       do not forget to install all other php modules that you are using within your software:\n            for example: apt install php-mysql if you are using mysql... \n    2. Navigate to the directory where you want to install yakpro-po (/usr/local is a good idea): \n       # cd /usr/local \n    3. Then retrieve from GitHub: \n       # git clone https://github.com/pk-fr/yakpro-po.git \n    4. Go to the yakpro-po directory: \n       # cd yakpro-po \n    5. Then retrieve from GitHub: \n       # git clone https://github.com/nikic/PHP-Parser.git --branch 4.x\n    6. Check that yakpro-po.php has execute rights, otherwise:\n                                            # chmod a+x yakpro-po.php \n    7. Create a symbolic link in the /usr/local/bin directory\n       # cd /usr/local/bin \n       # ln -s /usr/local/yakpro-po/yakpro-po.php yakpro-po \n    8. You can now run yakpro-po \n       # yakpro-po --help \n       # yakpro-po test.php \n\n    Modify a copy of the yakpro-po.cnf to fit your needs...\n    Read the \"Configuration file loading algorithm\" section of this document\n    to choose the best location suiting your needs!\n\n    That's it! You're done!\n\n####\n\n## Usage:\n\n`yakpro-po`\nObfuscates according configuration file!\n(See configuration file loading algorithm)\n\n`yakpro-po source_filename`\nObfuscates code to stdout\n\n`yakpro-po source_filename -o target_filename`\nObfuscates code to target_filename\n\n`yakpro-po source_directory -o target_directory`\nRecursivly obfuscates code to target_directory/yakpro-po (creates it if it does not already exist).\n\n`yakpro-po --config-file config_file_path`\nAccording to config_file_path.\n\n`yakpro-po --clean`\nRequires target_directory to be present in your config file!\nRecursivly removes target_directory/yakpro-po\n\n\n## Configuration file loading algorithm:\n(the first found is used)\n\n    --config-file argument value\n    YAKPRO_PO_CONFIG_FILE environment variable value if existing and not empty.\n\n    filename selection:\n           YAKPRO_PO_CONFIG_FILENAME environment variable value if existing and not empty,\n           yakpro-po.cnf otherwise.\n\n     file is then searched in the following directories:\n            YAKPRO_PO_CONFIG_DIRECTORY  environment variable value if existing and not empty.\n            current_working_directory\n            current_working_directory/config\n            home_directory\n            home_directory/config\n            /usr/local/YAK/yakpro-po\n            source_code_directory/default_conf_filename\n\n      if no config file is found, default values are used.\n\n      You can find the default config file as an example in the yakpro-po.cnf file of the\n      repository.\n      Do not modify it directly because it will be overwritten at each update!\n      Use your own yakpro-po.cnf file (for example in the root directory of your project)\n\n      When working on directories,\n      context is saved in order to reuse the same obfuscation translation table.\n      When you make some changes in one or several source files,\n      yakpro-po uses timestamps to only reobfuscate files that were changed\n      since the last obfuscation.\n      This can save you a lot of time.\n\n      caveats: does not delete files that are no more present...\n               use --clean  command line parameter, and then re-obfuscate all!\n\n## Other command line options:\n(override config file settings)\n\n    --silent                            do not display Information level messages.\n    --debug                             (internal debugging use) displays the syntax tree.\n\n    -s or\n    --no-strip-indentation              multi line output\n    --strip-indentation                 single line output\n\n    --no-shuffle-statements             do not shuffle statements\n    --shuffle-statements                       shuffle statements\n\n    --no-obfuscate-string-literal       do not obfuscate string literals\n    --obfuscate-string-literal                 obfuscate string literals\n\n    --no-obfuscate-loop-statement       do not obfuscate loop statements\n    --obfuscate-loop-statement                 obfuscate loop statements\n\n    --no-obfuscate-if-statement         do not obfuscate if statements\n    --obfuscate-if-statement                   obfuscate if statements\n\n    --no-obfuscate-constant-name        do not obfuscate constant names\n    --obfuscate-constant-name                  obfuscate constant names\n\n    --no-obfuscate-variable-name        do not obfuscate variable names\n    --obfuscate-variable-name                  obfuscate variable names\n\n    --no-obfuscate-function-name        do not obfuscate function names\n    --obfuscate-function-name                  obfuscate function names\n\n    --no-obfuscate-class_constant-name  do not obfuscate class constant names\n    --obfuscate-class_constant-name            obfuscate class constant names\n\n    --no-obfuscate-class-name           do not obfuscate class names\n    --obfuscate-class-name                     obfuscate class names\n\n    --no-obfuscate-interface-name       do not obfuscate interface names\n    --obfuscate-interface-name                 obfuscate interface names\n\n    --no-obfuscate-trait-name           do not obfuscate trait names\n    --obfuscate-trait-name                     obfuscate trait names\n\n    --no-obfuscate-property-name        do not obfuscate property names\n    --obfuscate-property-name                  obfuscate property names\n\n    --no-obfuscate-method-name          do not obfuscate method names\n    --obfuscate-method-name                    obfuscate method names\n\n    --no-obfuscate-namespace-name       do not obfuscate namespace names\n    --obfuscate-namespace-name                 obfuscate namespace names\n\n    --no-obfuscate-label-name           do not obfuscate label names\n    --obfuscate-label-name                     obfuscate label names\n\n    --scramble-mode     identifier|hexa|numeric         force scramble mode\n    --scramble-length   length ( min=2; max = 16 for scramble_mode=identifier,\n                                        max = 32 for scramble_mode = hexa or numeric)\n\n    --whatis scrambled_name             retrieves original symbol from obfuscation context.\n                                        (usefull for debugging your code when you give away\n                                        obfuscated code, and keep the same obfuscation context).\n                                        Tip: do not include the $ symbol, or use \\$ because\n                                        $ has special meaning in shell.\n\n    -h or\n    --help                              displays help.\n\n####\n\n## YOU MUST BE AWARE OF THE FOLLOWING:\n    If your obfuscated software makes use of external libraries\n    that you do not obfuscate along with your software:\n\n    if the library consists of functions:\n            set the $conf-\u003eobfuscate_function_name to false in your yakpro-po.cnf config file,\n            or declare all the functions names you are using in $conf-\u003et_ignore_functions\n            example : $conf-\u003et_ignore_functions = array('my_func1','my_func2');\n\n    if the library consists of classes :\n            set the $conf-\u003eobfuscate_class_name,\n                    $conf-\u003eobfuscate_property_name,\n                    $conf-\u003eobfuscate_method_name\n            to false in your yakpro-po.cnf config file...\n            ... or declare all the classes, properties, methods names you are using in\n                    $conf-\u003et_ignore_classes,\n                    $conf-\u003et_ignore_properties,\n                    $conf-\u003et_ignore_methods.\n\n    This is also true for PDO::FETCH_OBJ that retrieves properties from external source\n    (i.e. database columns).\n\n## Hints for preparing your Software to be run obfuscated\n\n    At first you can test obfuscating only variable names...\n\n\n    If you obfuscate functions, do not use indirect function calls like\n        $my_var = 'my_function';\n        $my_var();\n    or put all the function names you call indirectly in the $conf-\u003et_ignore_functions array!\n\n\n    Do not use indirect variable names!\n        $$my_var = something;\n    or put all the variable names you use indirectly in the $conf-\u003et_ignore_variables array!\n\n\n    Do not use PDO::FETCH_OBJ  but use PDO::FETCH_ASSOC instead!\n    or disable properties obfuscation in the config file.\n\n\n    If you use the define function for defining constants, the only allowed form is when the\n    define function has exactly 2 arguments, and the first one is a litteral string!\n    You MUST disable constants obfuscation in the config file, if you use any other forms\n    of the define function!\n    There is no problem with the const MY_CONST = something; form!\n\n\n## Performance considerations\n\n    Except for the statements shuffling obfuscation option,\n    the obfuscated program speed is almost the same than the original one.\n\n    $conf-\u003eshuffle_stmts    is set to true by default.\n\n    If you encounter performance issues, you can either set the option to false,\n    or fine tune the shuffle parameters with the associated options.\n\n    You must know that the lesser the chunk size, the better the obfuscation,\n    and the lower your software performance!\n\n    (during my own tests, the maximum of obfuscation costs me about 13% of performance)\n\n    You can tune it as you wish!\n\n\n\n## Known Issues\n\n[segmentation fault](https://github.com/php/php-src/issues/8193)\n\n    opcache crashes on Ubuntu 21.10 - php 8.0.8 (segfault) both within apache2 and cli when\n    shuffle-statements is turned on for big files\n    \n    works perfectly with newer versions of php (8.0.16 8.1 )\n    \n\n[sedimentation-fault](https://github.com/sedimentation-fault) reported on issue [#75](https://github.com/pk-fr/yakpro-po/issues/75) that a segmentation fault could occure in php's garbage collector when obfuscating many big files in a project:\n\n    Trying to obfuscate ~5000 PHP files of ~1000 lines each, yakpro-po stopped after processing ~1600 files \n    with a simple (and frustrating) Segmentation fault\n\n    Workaround:\n    \n    There is a stack overflow in garbage collector. The solution is to increase limit for stack.\n    To see your current limit, type\n\n    ulimit -s\n\n    I had 8192 - for a task of this size obviously totally undersized...\n    Change this to something more appropriate, say\n\n    ulimit -s 102400\n\n    and retry - the segmentation fault is gone! :-)\n    \n    \n    \n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpk-fr%2Fyakpro-po","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpk-fr%2Fyakpro-po","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpk-fr%2Fyakpro-po/lists"}