PHPackages                             babymarkt/composer-cleaner-plugin - 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. [CLI &amp; Console](/categories/cli)
4. /
5. babymarkt/composer-cleaner-plugin

ActiveComposer-plugin[CLI &amp; Console](/categories/cli)

babymarkt/composer-cleaner-plugin
=================================

A composer plugin to clean up your project directory

v1.0.0-beta.3(5y ago)20MITPHPPHP &gt;=5.6 || ^7

Since Sep 23Pushed 5y ago2 watchersCompare

[ Source](https://github.com/Baby-Markt/composer-cleaner-plugin)[ Packagist](https://packagist.org/packages/babymarkt/composer-cleaner-plugin)[ RSS](/packages/babymarkt-composer-cleaner-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

composer-cleaner-plugin
=======================

[](#composer-cleaner-plugin)

[![Build Status](https://camo.githubusercontent.com/aa41107639bd5fe9a1290345dd243f2eb4184f9c02e497431f698273a954274b/68747470733a2f2f7472617669732d63692e6f72672f426162792d4d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Baby-Markt/composer-cleaner-plugin) [![Packagist PHP Version Support](https://camo.githubusercontent.com/56c2d0488479d2e40ee1d1848a844f4e1de84e7757e9591eca4be2b873976f3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f626162796d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e)](https://camo.githubusercontent.com/56c2d0488479d2e40ee1d1848a844f4e1de84e7757e9591eca4be2b873976f3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f626162796d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e) [![version](https://camo.githubusercontent.com/6aa6a7dae0aad6a9b29eff6f2e0d962917bbcb725e4cb8a4dea198006b1af7f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626162796d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e3f7374796c653d666c6174)](https://packagist.org/packages/babymarkt/composer-cleaner-plugin) [![GitHub](https://camo.githubusercontent.com/5f09f4400bfe281f48d77673cac94f6430620591bd786240b938ffabd896d90d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f426162792d4d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e)](https://camo.githubusercontent.com/5f09f4400bfe281f48d77673cac94f6430620591bd786240b938ffabd896d90d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f426162792d4d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e) [![GitHub All Releases](https://camo.githubusercontent.com/04c7c456d2f763528fc0b9c99a2daff0ee01bd987a5149fb065b429586e1a55e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f426162792d4d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e2f746f74616c)](https://camo.githubusercontent.com/04c7c456d2f763528fc0b9c99a2daff0ee01bd987a5149fb065b429586e1a55e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f426162792d4d61726b742f636f6d706f7365722d636c65616e65722d706c7567696e2f746f74616c)

- [Install](#install)
- [Configure](#configure)
- [Run](#run)

Install
-------

[](#install)

To install the plugin use Composer:

```
composer require --dev babymarkt/composer-plugin-cleaner
```

Configure
---------

[](#configure)

The configuration must be placed in the `extra` section in `composer.json`. An example is:

```
{
  "name": "company/your-project",
  "type": "project",
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          "README*",
          ".git*"
        ],
        "paths": [
          "test",
          "artifacts"
        ],
        "exclude": [
          "test/important"
        ]
      }
    }
  },
  "require-dev": {
    "babymarkt/composer-plugin-cleaner": "*"
  }
}
```

The program contains a default configuration under the context `default` (Surprise surprise!). More detailed information can be found in the class [`AbstractCommand`](./src/Cleaner/AbstractCommand.php). Run

```
composer babymarkt:cleaner:clean default
```

to use it.

### Configuration options

[](#configuration-options)

#### `context`

[](#context)

Each configuration set is wrapped in a cleaning context. A context is a simple string which can be used on terminal to select the configuration.

```
{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "your cleaner options": "..."
      }
    }
  }
}
```

#### `pattern`

[](#pattern)

`pattern` contains a list of `glob` pattern to select files in the project directory tree. Consult the [PHP documentation](https://www.php.net/manual/de/function.glob.php)or [Wikipedia](https://en.wikipedia.org/wiki/Glob_(programming)) for more information about the `glob` function and patterns.

```
{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          "README*",
          ".git*"
        ]
      }
    }
  }
}
```

This example searches for files starting with `README` or `.git` in the complete project tree.

#### `paths`

[](#paths)

By default the cleaner command use the project root directory to search files (the directory that contains the `composer.json` file). With the option `paths`you can set multiple paths to search for files in instead of the default root directory. All paths are relative to the root directory, also such starting with an `/`. Paths outside the root are being ommited.

```
{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          ".git*"
        ],
        "paths": [
          "src",
          "vendor"
        ]
      }
    }
  }
}
```

This example searches for files starting with `.git` in `./src` and `./vendor`, nowhere else.

#### `exclude`

[](#exclude)

This option allows you to exclude files from deletion. The list consists of [RegEx](https://www.php.net/manual/de/reference.pcre.pattern.syntax.php) patterns, without specifying the delimiter characters. The pattern is applied to the entire path and not only to the file name. The used delimiter character is the `#`. If you need to use it in you pattern, you must escape it.

```
{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          "data/*"
        ],
        "exclude": [
          ".*\\.important"
        ]
      }
    }
  }
}
```

This example searches for paths starting with `data/` and NOT ends with `.important`.

Run
---

[](#run)

To run the command use composer:

```
composer babymarkt:cleaner:clean your-context-name
```

or add a custom script to your `composer.json`:

```
{
  "scripts": {
    "cleanup:dev": [
      "@composer babymarkt:cleaner:clean your-context-name"
    ]
  }
}
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2054d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/446784?v=4)[Niklas](/maintainers/u-nik)[@u-nik](https://github.com/u-nik)

---

Top Contributors

[![u-nik](https://avatars.githubusercontent.com/u/446784?v=4)](https://github.com/u-nik "u-nik (24 commits)")

---

Tags

cleanercleanupclicomposerphp5php7pluginremoversweeperplugincomposerfilescleanupdirectories

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/babymarkt-composer-cleaner-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/babymarkt-composer-cleaner-plugin/health.svg)](https://phpackages.com/packages/babymarkt-composer-cleaner-plugin)
```

###  Alternatives

[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

596161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k37.3M2.1k](/packages/ergebnis-composer-normalize)[brainmaestro/composer-git-hooks

Easily manage git hooks in your composer config

1.1k9.1M443](/packages/brainmaestro-composer-git-hooks)[pyrech/composer-changelogs

Display changelogs after each composer update

5904.0M25](/packages/pyrech-composer-changelogs)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

525.5M67](/packages/automattic-jetpack-autoloader)

PHPackages © 2026

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