{"id":15022875,"url":"https://github.com/baby-markt/composer-cleaner-plugin","last_synced_at":"2026-01-28T13:34:16.603Z","repository":{"id":62490955,"uuid":"295756252","full_name":"Baby-Markt/composer-cleaner-plugin","owner":"Baby-Markt","description":"A composer plugin to clean up your project folder during build or packaging processes.","archived":false,"fork":false,"pushed_at":"2020-09-23T17:36:47.000Z","size":92,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T17:56:19.397Z","etag":null,"topics":["cleaner","cleanup","cli","composer","php5","php7","plugin","remover","sweeper"],"latest_commit_sha":null,"homepage":"","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/Baby-Markt.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}},"created_at":"2020-09-15T14:36:10.000Z","updated_at":"2020-09-24T08:52:20.000Z","dependencies_parsed_at":"2022-11-02T11:03:30.157Z","dependency_job_id":null,"html_url":"https://github.com/Baby-Markt/composer-cleaner-plugin","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/Baby-Markt%2Fcomposer-cleaner-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baby-Markt%2Fcomposer-cleaner-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baby-Markt%2Fcomposer-cleaner-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baby-Markt%2Fcomposer-cleaner-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Baby-Markt","download_url":"https://codeload.github.com/Baby-Markt/composer-cleaner-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243318758,"owners_count":20272144,"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":["cleaner","cleanup","cli","composer","php5","php7","plugin","remover","sweeper"],"created_at":"2024-09-24T19:58:28.835Z","updated_at":"2026-01-28T13:34:16.576Z","avatar_url":"https://github.com/Baby-Markt.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# composer-cleaner-plugin\n[![Build Status](https://travis-ci.org/Baby-Markt/composer-cleaner-plugin.svg?branch=master)](https://travis-ci.org/Baby-Markt/composer-cleaner-plugin) ![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/babymarkt/composer-cleaner-plugin) [![version](https://img.shields.io/packagist/v/babymarkt/composer-cleaner-plugin?style=flat)](https://packagist.org/packages/babymarkt/composer-cleaner-plugin) ![GitHub](https://img.shields.io/github/license/Baby-Markt/composer-cleaner-plugin) ![GitHub All Releases](https://img.shields.io/github/downloads/Baby-Markt/composer-cleaner-plugin/total) \n\n* [Install](#install)\n* [Configure](#configure)\n* [Run](#run)\n\n## Install\nTo install the plugin use Composer:\n```bash\ncomposer require --dev babymarkt/composer-plugin-cleaner\n```\n\n## Configure\nThe configuration must be placed in the `extra` section in `composer.json`. An example is:\n```json\n{\n  \"name\": \"company/your-project\",\n  \"type\": \"project\",\n  \"extra\": {\n    \"babymarkt:cleaner\": {\n      \"context-name\": {\n        \"pattern\": [\n          \"README*\",\n          \".git*\"\n        ],\n        \"paths\": [\n          \"test\",\n          \"artifacts\"\n        ],\n        \"exclude\": [\n          \"test/important\"\n        ]\n      }\n    }\n  },\n  \"require-dev\": {\n    \"babymarkt/composer-plugin-cleaner\": \"*\"\n  }\n}\n```\nThe program contains a default configuration under the context `default` (Surprise surprise!). \nMore detailed information can be found in the class \n[`AbstractCommand`](./src/Cleaner/AbstractCommand.php). Run \n```bash\ncomposer babymarkt:cleaner:clean default\n```\nto use it.\n\n### Configuration options\n\n#### `context`\nEach configuration set is wrapped in a cleaning context. A context is a simple string\nwhich can be used on terminal to select the configuration.\n```json\n{\n  \"extra\": {\n    \"babymarkt:cleaner\": {\n      \"context-name\": {\n        \"your cleaner options\": \"...\"\n      }\n    }\n  }\n}\n```\n#### `pattern`\n`pattern` contains a list of `glob` pattern to select files in the project \ndirectory tree. Consult the [PHP documentation](https://www.php.net/manual/de/function.glob.php) \nor [Wikipedia](https://en.wikipedia.org/wiki/Glob_(programming)) for more information about the `glob` function and patterns.  \n```json\n{\n  \"extra\": {\n    \"babymarkt:cleaner\": {\n      \"context-name\": {\n        \"pattern\": [\n          \"README*\",\n          \".git*\"\n        ]\n      }\n    }\n  }\n}\n```\nThis example searches for files starting with `README` or `.git` in the complete \nproject tree. \n\n#### `paths`\nBy default the cleaner command use the project root directory to search files \n(the directory that contains the `composer.json` file). With the option `paths`\nyou can set multiple paths to search for files in instead of the default root \ndirectory. All paths are relative to the root directory, also such starting \nwith an `/`. Paths outside the root are being ommited.\n```json\n{\n  \"extra\": {\n    \"babymarkt:cleaner\": {\n      \"context-name\": {\n        \"pattern\": [\n          \".git*\"\n        ],\n        \"paths\": [\n          \"src\",\n          \"vendor\"\n        ]\n      }\n    }\n  }\n}\n```\nThis example searches for files starting with `.git` in `./src` and `./vendor`, nowhere else.\n\n#### `exclude`\nThis option allows you to exclude files from deletion. The list consists of \n[RegEx](https://www.php.net/manual/de/reference.pcre.pattern.syntax.php) patterns, without specifying the delimiter characters. The pattern is \napplied to the entire path and not only to the file name. The used delimiter \ncharacter is the `#`. If you need to use it in you pattern, you must escape it.\n```json\n{\n  \"extra\": {\n    \"babymarkt:cleaner\": {\n      \"context-name\": {\n        \"pattern\": [\n          \"data/*\"\n        ],\n        \"exclude\": [\n          \".*\\\\.important\"\n        ]\n      }\n    }\n  }\n}\n```\nThis example searches for paths starting with `data/` and NOT ends with \n`.important`. \n\n## Run\nTo run the command use composer:\n```bash    \ncomposer babymarkt:cleaner:clean your-context-name\n```\nor add a custom script to your `composer.json`:\n```json\n{\n  \"scripts\": {\n    \"cleanup:dev\": [\n      \"@composer babymarkt:cleaner:clean your-context-name\"\n    ]\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaby-markt%2Fcomposer-cleaner-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaby-markt%2Fcomposer-cleaner-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaby-markt%2Fcomposer-cleaner-plugin/lists"}