PHPackages                             muqsit/preprocessor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. muqsit/preprocessor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

muqsit/preprocessor
===================

PHP library to ready code for production

252051PHPCI failing

Since Jun 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Muqsit/PreProcessor)[ Packagist](https://packagist.org/packages/muqsit/preprocessor)[ RSS](/packages/muqsit-preprocessor/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PreProcessor
============

[](#preprocessor)

Comment out debug code before pushing it to production.

Quick Start
-----------

[](#quick-start)

### Installing

[](#installing)

Install the library using composer:

```
composer require muqsit/preprocessor:dev-master

```

### Preprocessing a list of PHP files

[](#preprocessing-a-list-of-php-files)

```
require_once "src/proxy/Client.php";
require_once "src/proxy/Server.php";
require_once "src/proxy/Logger.php";

use muqsit\preprocessor\PreProcessor;
use proxy\Logger;

PreProcessor::fromPaths(["src/proxy/Client.php", "src/proxy/Server.php", "src/proxy/Logger.php"]) // files to preprocess
	->commentOut(Logger::class, "debug")
	->export("./preprocessed-src"); // preprocessed files written to ./preprocessed-src folder
```

Result:

```
final class Client{

	/** @var Logger */
	private $logger;

	public function onLogin(){
-		$this->logger->debug("Client logged in");
+		/* $this->logger->debug("Client logged in ") */;
	}
}
```

### Preprocessing a directory of PHP files

[](#preprocessing-a-directory-of-php-files)

```
require "vendor/autoload.php";

use muqsit\preprocessor\PreProcessor;
use pocketmine\entity\Entity;
use pocketmine\Player;
use pocketmine\utils\Utils;

PreProcessor::fromDirectory("./src") // searches for .php files recursively
	->commentOut(Logger::class, "debug")
	->commentOut(Utils::class, "testValidInstance")
	->commentOut(Utils::class, "validateCallableSignature")
	->commentOut(Client::class, "debugClientStatus")
	->export("./preprocessed-src");
```

Result:

```
final class Player extends Client implements LoggerHolder{

	public function onJoin() : void{
-		$this->getLogger()->debug("Player {$this->getUUID()} joined");
+		/* $this->getLogger()->debug("Player {$this->getUUID()} joined") */;

-		$this->sendMessage("You joined the server"); $this->debugClientStatus();
+		$this->sendMessage("You joined the server"); /* $this->debugClientStatus() */;
	}

	public function registerQuitListener(Closure $listener) : void{
-		Utils::validateCallableSignature(function(Player $player) : void{}, $listener);
+		/* Utils::validateCallableSignature(function(Player $player) : void{}, $listener) */;
	}
}
```

Libraries Used
--------------

[](#libraries-used)

- [nikic/PHP-Parser](https://github.com/nikic/PHP-Parser/) - Reading and writing nodes using the formatting-preservation functionality
- [phpstan/phpstan](https://github.com/phpstan/phpstan) - Determinig type of variables, properties, methods etc within the scope

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 99% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/247134f60bf8c5c7c8a2f06b0ecea431a052614283aac5093b57bde51039e34a?d=identicon)[muqsit](/maintainers/muqsit)

---

Top Contributors

[![Muqsit](https://avatars.githubusercontent.com/u/15074389?v=4)](https://github.com/Muqsit "Muqsit (100 commits)")[![xxAROX](https://avatars.githubusercontent.com/u/57589973?v=4)](https://github.com/xxAROX "xxAROX (1 commits)")

---

Tags

compilerphpphp-parserphpstan

### Embed Badge

![Health badge](/badges/muqsit-preprocessor/health.svg)

```
[![Health](https://phpackages.com/badges/muqsit-preprocessor/health.svg)](https://phpackages.com/packages/muqsit-preprocessor)
```

###  Alternatives

[laminas/laminas-config-aggregator-parameters

PostProcessor extension for laminas/laminas-config-aggregator to allow usage of templated parameters within your configuration

1094.4k](/packages/laminas-laminas-config-aggregator-parameters)[dahmen/automad-terminal

A minimal Automad blog theme for terminal lovers

522.3k](/packages/dahmen-automad-terminal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
