Skip to main content

Composer, the dependency manager for PHP, does supports meta-packages. A meta-package is a package that doesn't contain any actual code or files itself but rather defines a collection of dependencies.

Here's how you can use a meta-package:

  1. Define Dependencies: In the composer.json file of the meta-package, you list the packages that you want to include as dependencies. You don't include any actual code, classes, or files in the meta-package itself.

  2. Versioning: You can define specific versions or version constraints for the dependencies in the meta-package. This ensures that all the included packages are compatible with each other.

  3. Installation: When someone requires your meta-package using Composer, all the defined dependencies will be installed together. It's a convenient way to bundle related packages.

  4. Use Case: Meta-packages are often used to bundle together a set of related packages that work well together, such as a framework with its standard plugins or a set of development tools.

Here's an example of what a meta-package's composer.json might look like:

{
    "name": "my-vendor/my-metapackage",
    "type": "metapackage",
    "require": {
        "some-vendor/package-one": "^1.0",
        "another-vendor/package-two": "^2.1"
    }
}

The key here is that the meta-package itself doesn't contain any code. It's just a way to define a set of packages that should be installed together. It's a neat way to keep things organised and ensure compatibility.