PHPackages                             stanleyxc/composer-extra - 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. stanleyxc/composer-extra

ActiveComposer-plugin

stanleyxc/composer-extra
========================

Like make clean. A simple package cleaner for deployment.

08PHP

Since Mar 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/stanleyxc/composer-extra)[ Packagist](https://packagist.org/packages/stanleyxc/composer-extra)[ RSS](/packages/stanleyxc-composer-extra/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

composer-extra
==============

[](#composer-extra)

A simple deployment cleaner for composer packages.

A 'make clean' like functionality to clean up composer's packages to minimize deployment code size footprint.
Leveraging composer's plug-in API, script functionality. Introduces a custom sub-block (named deployment) in composer.json schema's extra property.

### Warning:

[](#warning)

This is pre-production release. I've only used and test in Linux enviroment. Nor have I tested this in composer global install settings.

I strongly recommand you use this tool in your dev environment extensively before trying it on production. And since this tool make changes to your filesystem (it uses php fnmatch with unlink and rmdir), I can't caution enough --- make sure you have backups in place before running this tool

\###Composer Install:

```
composer require stanleyxc/composer-extra

```

\###Usage: Using composer plug-in

```
composer deploy-clean twig/twig phpmailer/phpmailer

```

The above command will clean composer package twig and phpmailer assuming there are extra/deployment information in your project's root composer.json file. For example, below is extra/deployment specifies the files/directories I want for my deployment (your's likely will be different)

```
{
    "extra":
    {
    	"deployment":
      {
        "phpmailer/phpmailer" 	: ["*.php", "extras", "LICENSE", "VERSION"],
        "twig/twig"             : ["LICENSE", "lib", "doc", "ext"]
	    }
    }
}

```

Deployment parameter block contains one array list per package specifying the directories and files you want to keep for deployment. Everything else not listed will be removed.

Using composer script functionality.
In order to use deployment cleaner in script mode, one more parameter blocks are needed in composer.json: script name and hook defintion.

```
{
    "extra":
    {
    	"deployment":
      {
        "phpmailer/phpmailer" 	: ["*.php", "extras", "LICENSE", "VERSION"],
        "twig/twig"             : ["LICENSE", "lib", "doc", "ext"]
	    }
    },
    "scripts":
    {
       "script:deploy" :
       [
          "Stanleyxc\\ComposerExtra\\Script::main"
       ]
    }
}

```

then run

```
composer script:deploy twig/twig phpmailer/phpmailer

```

---

You can also customize the command in script mode to your liking, eg. rename script:deploy to clean then

```
composer clean twig/twig

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab1c47c94d2bf276b2bbb551a547193364043dda80aec411bfe37eb752154b74?d=identicon)[stanleyxc](/maintainers/stanleyxc)

---

Top Contributors

[![stanleyxc](https://avatars.githubusercontent.com/u/9559486?v=4)](https://github.com/stanleyxc "stanleyxc (5 commits)")

### Embed Badge

![Health badge](/badges/stanleyxc-composer-extra/health.svg)

```
[![Health](https://phpackages.com/badges/stanleyxc-composer-extra/health.svg)](https://phpackages.com/packages/stanleyxc-composer-extra)
```

PHPackages © 2026

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