63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Phabel\Composer;
|
||
|
|
||
|
use Composer\Composer;
|
||
|
use Composer\EventDispatcher\EventSubscriberInterface;
|
||
|
use Composer\Installer\InstallerEvent;
|
||
|
use Composer\Installer\InstallerEvents;
|
||
|
use Composer\IO\IOInterface;
|
||
|
use Composer\Plugin\PluginInterface;
|
||
|
|
||
|
/**
|
||
|
* @author Daniil Gentili <daniil@daniil.it>
|
||
|
* @license MIT
|
||
|
*/
|
||
|
class Plugin implements PluginInterface, EventSubscriberInterface
|
||
|
{
|
||
|
/**
|
||
|
* IO interface.
|
||
|
*/
|
||
|
private IOInterface $io;
|
||
|
/**
|
||
|
* Apply plugin modifications to Composer.
|
||
|
*
|
||
|
* @param Composer $composer Composer instance
|
||
|
* @param IOInterface $io IO instance
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function activate(Composer $composer, IOInterface $io): void
|
||
|
{
|
||
|
$repoManager = $composer->getRepositoryManager();
|
||
|
$repos = $repoManager->getRepositories();
|
||
|
$repoManager->prependRepository()
|
||
|
$this->io = $io;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* {@inheritdoc}
|
||
|
*/
|
||
|
public static function getSubscribedEvents()
|
||
|
{
|
||
|
return [
|
||
|
InstallerEvents::PRE_DEPENDENCIES_SOLVING =>
|
||
|
['onDependencySolve', 100000],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Emitted before composer solves dependencies
|
||
|
*
|
||
|
* @param InstallerEvent $event Event
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function onDependencySolve(InstallerEvent $event): void
|
||
|
{
|
||
|
var_dump($event);
|
||
|
}
|
||
|
|
||
|
}
|