Skip to content

Commit 25c294a

Browse files
Merge pull request #10 from CaptainHookPhp/updateToComposerPluginApi2
Update to Composer Plugin-API 2.0
2 parents 3e122bc + 48cb2de commit 25c294a

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"require": {
1717
"php": "^7.1",
18-
"composer-plugin-api": "^1.1",
18+
"composer-plugin-api": "^1.1|^2.0",
1919
"captainhook/captainhook": "^5.0"
2020
},
2121
"require-dev": {

src/ComposerPlugin.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,36 @@ public function activate(Composer $composer, IOInterface $io): void
7979
$this->io = $io;
8080
}
8181

82+
/**
83+
* Remove any hooks from Composer
84+
*
85+
* This will be called when a plugin is deactivated before being
86+
* uninstalled, but also before it gets upgraded to a new version
87+
* so the old one can be deactivated and the new one activated.
88+
*
89+
* @param Composer $composer
90+
* @param IOInterface $io
91+
*/
92+
public function deactivate(Composer $composer, IOInterface $io)
93+
{
94+
// Do nothing currently
95+
}
96+
97+
/**
98+
* Prepare the plugin to be uninstalled
99+
*
100+
* This will be called after deactivate.
101+
*
102+
* @param Composer $composer
103+
* @param IOInterface $io
104+
*/
105+
public function uninstall(Composer $composer, IOInterface $io)
106+
{
107+
// Do nothing currently
108+
}
109+
110+
111+
82112
/**
83113
* Make sure the installer is executed after the autoloader is created
84114
*

0 commit comments

Comments
 (0)