Skip to content

Commit 79c4749

Browse files
authored
Merge pull request #128 from packagist/block-package
Docs: explain how to block packages
2 parents 25bcb33 + 122a2f4 commit 79c4749

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/setup.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,26 @@ Alternatively you may submit an array of packages to define multiple versions:
187187
]
188188
```
189189
Once a custom package has been added to Private Packagist you will benefit from mirroring the zip file. Composer will have an additional location to download the file from if the original storage becomes unavailable.
190+
191+
### Prevent a package from being used with custom packages
192+
193+
While there is no direct "block package" feature in Packagist, you can effectively prevent a specific package from being used in your project by creating a placeholder package.
194+
195+
The package type [metapackage](https://getcomposer.org/doc/04-schema.md#type) ensures no code is associated with it. Optionally, you can mark the package as [abandoned](https://getcomposer.org/doc/04-schema.md#abandoned) and, if needed, suggest an alternative.
196+
197+
```json
198+
{
199+
"name": "acme/blocked-package",
200+
"version": "0.0.1",
201+
"type": "metapackage",
202+
"abandoned": "acme/other-package"
203+
}
204+
```
205+
206+
If necessary, make sure the package is added to all relevant suborganizations.
207+
208+
This placeholder package will prevent any other package with the same name from being mirrored automatically, effectively blocking the problematic package from being used in your projects.
209+
190210
## Add an artifact package
191211

192212
You can upload code archives via *Add Package -> Artifact*. Your uploaded archives need to contain a valid composer.json file in its root directory and must be of type zip, gz, or bz2. Once you upload your code archives, you can save the artifact package and use it in your organization.

0 commit comments

Comments
 (0)