@ -22,15 +22,19 @@ Composer fires the following named events during its execution process:
### Command Events
### Command Events
- **pre-install-cmd**: occurs before the `install` command is executed with a lock file present.
- **pre-install-cmd**: occurs before the `install` command is executed with a
- **post-install-cmd**: occurs after the `install` command has been executed with a lock file present.
lock file present.
- **pre-update-cmd**: occurs before the `update` command is executed, or before the `install` command is executed without a lock file present.
- **post-install-cmd**: occurs after the `install` command has been executed
- **post-update-cmd**: occurs after the `update` command has been executed, or after the `install` command has been executed without a lock file present.
with a lock file present.
- **pre-update-cmd**: occurs before the `update` command is executed, or before
the `install` command is executed without a lock file present.
- **post-update-cmd**: occurs after the `update` command has been executed, or
after the `install` command has been executed without a lock file present.
- **post-status-cmd**: occurs after the `status` command has been executed.
- **post-status-cmd**: occurs after the `status` command has been executed.
- **pre-archive-cmd**: occurs before the `archive` command is executed.
- **pre-archive-cmd**: occurs before the `archive` command is executed.
- **post-archive-cmd**: occurs after the `archive` command has been executed.
- **post-archive-cmd**: occurs after the `archive` command has been executed.
- **pre-autoload-dump**: occurs before the autoloader is dumped, either
- **pre-autoload-dump**: occurs before the autoloader is dumped, either during
during `install`/`update`, or via the `dump-autoload` command.
`install`/`update`, or via the `dump-autoload` command.
- **post-autoload-dump**: occurs after the autoloader has been dumped, either
- **post-autoload-dump**: occurs after the autoloader has been dumped, either
during `install`/`update`, or via the `dump-autoload` command.
during `install`/`update`, or via the `dump-autoload` command.
- **post-root-package-install**: occurs after the root package has been
- **post-root-package-install**: occurs after the root package has been
@ -150,6 +154,11 @@ class MyClass
}
}
```
```
**Note:** During a composer install or update process, a variable named
`COMPOSER_DEV_MODE` will be added to the environment. If the command was run
with the `--no-dev` flag, this variable will be set to 0, otherwise it will be
set to 1.
## Event classes
## Event classes
When an event is fired, your PHP callback receives as first argument a
When an event is fired, your PHP callback receives as first argument a
"description":"This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
"description":"This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"replace":{
"replace":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
"description":"This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"conflict":{
"conflict":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
"description":"This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"provide":{
"provide":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
"description":"This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"require-dev":{
"require-dev":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
"description":"This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"suggest":{
"suggest":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
"description":"This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"config":{
"config":{
"type":"object",
"type":"object",
@ -134,12 +146,16 @@
"github-oauth":{
"github-oauth":{
"type":"object",
"type":"object",
"description":"A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
"description":"A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"gitlab-oauth":{
"gitlab-oauth":{
"type":"object",
"type":"object",
"description":"A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
"description":"A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"gitlab-token":{
"gitlab-token":{
"type":"object",
"type":"object",
@ -165,7 +181,20 @@
"http-basic":{
"http-basic":{
"type":"object",
"type":"object",
"description":"A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
"description":"A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
"additionalProperties":true
"additionalProperties":{
"type":"object",
"required":["username","password"],
"properties":{
"username":{
"type":"string",
"description":"The username used for HTTP Basic authentication"
},
"password":{
"type":"string",
"description":"The password used for HTTP Basic authentication"
}
}
}
},
},
"store-auths":{
"store-auths":{
"type":["string","boolean"],
"type":["string","boolean"],
@ -174,7 +203,9 @@
"platform":{
"platform":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
"description":"This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
"additionalProperties":true
"additionalProperties":{
"type":"string"
}
},
},
"vendor-dir":{
"vendor-dir":{
"type":"string",
"type":"string",
@ -280,12 +311,22 @@
"psr-0":{
"psr-0":{
"type":"object",
"type":"object",
"description":"This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
"description":"This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
"additionalProperties":true
"additionalProperties":{
"type":["string","array"],
"items":{
"type":"string"
}
}
},
},
"psr-4":{
"psr-4":{
"type":"object",
"type":"object",
"description":"This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
"description":"This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
"additionalProperties":true
"additionalProperties":{
"type":["string","array"],
"items":{
"type":"string"
}
}
},
},
"classmap":{
"classmap":{
"type":"array",
"type":"array",
@ -308,12 +349,22 @@
"psr-0":{
"psr-0":{
"type":"object",
"type":"object",
"description":"This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
"description":"This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
"additionalProperties":true
"additionalProperties":{
"type":["string","array"],
"items":{
"type":"string"
}
}
},
},
"psr-4":{
"psr-4":{
"type":"object",
"type":"object",
"description":"This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
"description":"This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",