Skip to content

Instantly share code, notes, and snippets.

@sbuzonas
Created June 15, 2015 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbuzonas/50f3a450650b9a193e44 to your computer and use it in GitHub Desktop.
Save sbuzonas/50f3a450650b9a193e44 to your computer and use it in GitHub Desktop.
<?php
public function getInstaller($type)
{
// Plugin API 1.1
foreach ($pm->getCapabilities('Composer\Plugin\Capability\Installable') as $installCap) {
if ($installCap->supports($type)) {
return $installCap;
}
}
// Plugin API 1.2
foreach ($pm->getCapabilities('Composer\Plugin\Capability\Installable2') as $capability) {
// some other setup
}
}
public function getInstaller($type)
{
/**
* Plugin API 5.0
* Composer drops support for "Installable".
* "Installable2" is renamed to "Installable"
*/
foreach ($pm->getAllPluginCapabilities('Composer\Plugin\Capability\Installable') as $installCap) {
// some setup
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment