{"id":15655116,"url":"https://github.com/muqsit/preprocessor","last_synced_at":"2025-10-19T16:53:59.919Z","repository":{"id":45625795,"uuid":"278196665","full_name":"Muqsit/PreProcessor","owner":"Muqsit","description":"A PHP compiler written in PHP using PHPStan for code analysis.","archived":false,"fork":false,"pushed_at":"2025-02-16T20:55:51.000Z","size":106,"stargazers_count":25,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T23:37:56.529Z","etag":null,"topics":["compiler","php","php-parser","phpstan"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Muqsit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-07-08T21:19:59.000Z","updated_at":"2025-02-16T20:55:54.000Z","dependencies_parsed_at":"2023-11-12T02:30:51.168Z","dependency_job_id":"6866ff5a-1973-4bc9-b34a-82d2843afd04","html_url":"https://github.com/Muqsit/PreProcessor","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":0.1578947368421053,"last_synced_commit":"1c5e42ddfd3205228aa8d2289190a087bf102c4c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muqsit%2FPreProcessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muqsit%2FPreProcessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muqsit%2FPreProcessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muqsit%2FPreProcessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Muqsit","download_url":"https://codeload.github.com/Muqsit/PreProcessor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741148,"owners_count":21154249,"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":["compiler","php","php-parser","phpstan"],"created_at":"2024-10-03T12:56:24.001Z","updated_at":"2025-10-19T16:53:54.894Z","avatar_url":"https://github.com/Muqsit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PreProcessor\nComment out debug code before pushing it to production.\n\n## Quick Start\n\n### Installing\nInstall the library using composer:\n```\ncomposer require muqsit/preprocessor:dev-master\n```\n\n### Preprocessing a list of PHP files\n```php\nrequire_once \"src/proxy/Client.php\";\nrequire_once \"src/proxy/Server.php\";\nrequire_once \"src/proxy/Logger.php\";\n\nuse muqsit\\preprocessor\\PreProcessor;\nuse proxy\\Logger;\n\nPreProcessor::fromPaths([\"src/proxy/Client.php\", \"src/proxy/Server.php\", \"src/proxy/Logger.php\"]) // files to preprocess\n\t-\u003ecommentOut(Logger::class, \"debug\")\n\t-\u003eexport(\"./preprocessed-src\"); // preprocessed files written to ./preprocessed-src folder\n```\nResult:\n```diff\nfinal class Client{\n\n\t/** @var Logger */\n\tprivate $logger;\n\n\tpublic function onLogin(){\n-\t\t$this-\u003elogger-\u003edebug(\"Client logged in\");\n+\t\t/* $this-\u003elogger-\u003edebug(\"Client logged in \") */;\n\t}\n}\n```\n\n### Preprocessing a directory of PHP files\n```php\nrequire \"vendor/autoload.php\";\n\nuse muqsit\\preprocessor\\PreProcessor;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\Utils;\n\nPreProcessor::fromDirectory(\"./src\") // searches for .php files recursively\n\t-\u003ecommentOut(Logger::class, \"debug\")\n\t-\u003ecommentOut(Utils::class, \"testValidInstance\")\n\t-\u003ecommentOut(Utils::class, \"validateCallableSignature\")\n\t-\u003ecommentOut(Client::class, \"debugClientStatus\")\n\t-\u003eexport(\"./preprocessed-src\");\n```\nResult:\n```diff\nfinal class Player extends Client implements LoggerHolder{\n\n\tpublic function onJoin() : void{\n-\t\t$this-\u003egetLogger()-\u003edebug(\"Player {$this-\u003egetUUID()} joined\");\n+\t\t/* $this-\u003egetLogger()-\u003edebug(\"Player {$this-\u003egetUUID()} joined\") */;\n\n-\t\t$this-\u003esendMessage(\"You joined the server\"); $this-\u003edebugClientStatus();\n+\t\t$this-\u003esendMessage(\"You joined the server\"); /* $this-\u003edebugClientStatus() */;\n\t}\n\n\tpublic function registerQuitListener(Closure $listener) : void{\n-\t\tUtils::validateCallableSignature(function(Player $player) : void{}, $listener);\n+\t\t/* Utils::validateCallableSignature(function(Player $player) : void{}, $listener) */;\n\t}\n}\n```\n\n## Libraries Used\n- [nikic/PHP-Parser](https://github.com/nikic/PHP-Parser/) - Reading and writing nodes using the formatting-preservation functionality\n- [phpstan/phpstan](https://github.com/phpstan/phpstan) - Determinig type of variables, properties, methods etc within the scope\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuqsit%2Fpreprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuqsit%2Fpreprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuqsit%2Fpreprocessor/lists"}