I'm doing a short post package install/update script to copy some files from the vendor directory into my public one.
Following the example of the composer site however when I execute it I get an error:
Fatal error: Call to undefined method Composer\DependencyResolver\Operation\UpdateOperation::getPackage() in S:\Projects\composer-scripts\FileCopy.php on line 17
The code is:
namespace composer-scipts;
use Composer\Script\Event;
class FileCopy
{
public static function postPackageInstall( Event $event )
{
$packageName = $event->getOperation()->getPackage()->getName();
echo "$packageName\n";
}
public static function postPackageUpdate( Event $event )
{
$packageName = $event->getOperation()->getPackage()->getName();
echo "$packageName\n";
}
}
Can anyone please advise?
composer.jsonis: "psr-4": { "composer-scripts": "vendor/wip/composer-scripts" }, "scripts": { "post-package-install": [ "FileCopy::postPackageInstall" ], "post-package-update": [ "FileCopy::postPackageUpdate" ] } - Adam M.