PHPackages                             hanoii/composer-should-not - 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. hanoii/composer-should-not

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

hanoii/composer-should-not
==========================

Provides a way to prevent installing configured versions of packages.

1.1.0(1y ago)11.7k↓63.5%MITPHP

Since Oct 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hanoii/composer-should-not)[ Packagist](https://packagist.org/packages/hanoii/composer-should-not)[ RSS](/packages/hanoii-composer-should-not/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Composer should-not
===================

[](#composer-should-not)

This plugin removes certain versions from your dependency list preventing them from being installed and provide a reason for doing so.

While the idea of versions constraint is that you can do this on your `composer.json` that works OK as long as everybody in your team knows what to do when changing or requiring a new version constraint.

This module is meant to provide a fail-safe and document a reason for doing so that if others tries to change the current constraint that will fail and a warning with a reason will be provided.

Installation
------------

[](#installation)

Install as usual:

```
composer require hanoii/composer-should-not
```

Usage
-----

[](#usage)

The configuration of this plugin is through the ["extra" property](https://getcomposer.org/doc/04-schema.md#extra)of your `composer.json` file.

```
{
    "extra": {
        "should-not": {
            "drupal/block_class": {
                "version": "^3",
                "reason": "Version constraint ^3 should not be installed, it is the a new release of the previous 1.x codebase."
            }
        }
    }
}
```

Alternatively, you can also provide an array of reasons:

```
    "should-not": {
        "twig/twig": {
            "version": "~3.14.1",
            "reasons": [
                "3.14.1: Recurssion issue on drupal https://www.drupal.org/project/drupal/issues/3485956.",
                "3.14.2: Performance issues on drupal https://www.drupal.org/project/drupal/issues/3487031."
            ]
        }
    },
```

Note

[dev versions](https://getcomposer.org/doc/articles/versions.md#branches) are always allowed.

Demo
----

[](#demo)

[![composer-should-not demo animated gif](https://private-user-images.githubusercontent.com/677879/381571674-f84f7d15-26f7-477e-b8f3-6fc07cba66df.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODU2NTk1MjEsIm5iZiI6MTc4NTY1OTIyMSwicGF0aCI6Ii82Nzc4NzkvMzgxNTcxNjc0LWY4NGY3ZDE1LTI2ZjctNDc3ZS1iOGYzLTZmYzA3Y2JhNjZkZi5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwODAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDgwMlQwODI3MDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZGIyMTkzOGY5Y2EyMzlkMzUxYzU1NzQzOGE5NDE3MjhmMTMwN2UyMTQzODA1N2NiNDY1ZDdkYjVkZmNlYzdhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZnaWYifQ.YBd3JtAd-XD_kLw7iepeHFLR1ohm_Mv3olqJmN_wRqg)](https://private-user-images.githubusercontent.com/677879/381571674-f84f7d15-26f7-477e-b8f3-6fc07cba66df.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODU2NTk1MjEsIm5iZiI6MTc4NTY1OTIyMSwicGF0aCI6Ii82Nzc4NzkvMzgxNTcxNjc0LWY4NGY3ZDE1LTI2ZjctNDc3ZS1iOGYzLTZmYzA3Y2JhNjZkZi5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwODAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDgwMlQwODI3MDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZGIyMTkzOGY5Y2EyMzlkMzUxYzU1NzQzOGE5NDE3MjhmMTMwN2UyMTQzODA1N2NiNDY1ZDdkYjVkZmNlYzdhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZnaWYifQ.YBd3JtAd-XD_kLw7iepeHFLR1ohm_Mv3olqJmN_wRqg)

---

The provided example configuration is what encouraged the creation of this plugin, see [https://www.drupal.org/project/block\_class/issues/3468976](https://www.drupal.org/project/block_class/issues/3468976).

They decided to create a new major version out of an older codebase 🤷, and it has proven to be an issue for us, so with this we can preemptively avoid the module from being upgrade to 3.0. This was fixed with a new 4.0.0 release.

However, other times I wanted something like this for ducumenting why a certain dependency should be locked to a specific version (something that I needed several times in Drupal projects).

###  Health Score

28

—

LowBetter than 51% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity22

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.

###  Release Activity

Cadence

Every ~20 days

Total

2

Last Release

637d ago

### Community

Maintainers

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

---

Top Contributors

[![hanoii](https://avatars.githubusercontent.com/u/677879?v=4)](https://github.com/hanoii "hanoii (18 commits)")

### Embed Badge

![Health badge](/badges/hanoii-composer-should-not/health.svg)

```
[![Health](https://phpackages.com/badges/hanoii-composer-should-not/health.svg)](https://phpackages.com/packages/hanoii-composer-should-not)
```

###  Alternatives

[symfony/runtime

Enables decoupling PHP applications from global state

740103.0M1.2k](/packages/symfony-runtime)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5346.5M600](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2125.4M213](/packages/drupal-core-project-message)[phpro/grumphp-shim

GrumPHP Phar distribution

284.9M348](/packages/phpro-grumphp-shim)[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

566.3M167](/packages/automattic-jetpack-autoloader)[altis/core

Core module for Altis

19233.0k4](/packages/altis-core)

PHPackages © 2026

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