public static function handle(PackageEvent $event)
    {
        $operation = $event->getOperation();
        if ($operation instanceof InstallOperation) {
            $package = $operation->getPackage();
        } elseif ($operation instanceof UpdateOperation) {
            $package = $operation->getTargetPackage();
        } else {
            return;
        }

        $extra = $package->getExtra();
        if ($package->getType() !== 'bolt-extension' || !isset($extra['bolt-assets'])) {
            return;
        }

        $rootExtra = $event->getComposer()->getPackage()->getExtra();
        if (realpath($rootExtra['bolt-web-path']) === realpath($rootExtra['bolt-root-path'])) {
            return;
        }

        // Copy package assets to main web path
        $src = 'vendor/' . $package->getName() . '/' . $extra['bolt-assets'];
        $dest = $rootExtra['bolt-web-path'] . '/extensions/vendor/' . $package->getName();

        self::mirror($src, $dest, $event);
    }
public static function handle(PackageEvent $event)
    {
        $operation = $event->getOperation();
        if ($operation instanceof InstallOperation) {
            $package = $operation->getPackage();
        } elseif ($operation instanceof UpdateOperation) {
            $package = $operation->getTargetPackage();
        } else {
            return;
        }

        $extra = $package->getExtra();
        if ($package->getType() !== 'bolt-extension' || !isset($extra['bolt-assets'])) {
            return;
        }

        $rootExtra = $event->getComposer()->getPackage()->getExtra();
        if (realpath($rootExtra['bolt-web-path']) === realpath($rootExtra['bolt-root-path'])) {
            return;
        }

        // Copy package assets to main web path
        $src = 'vendor/' . $package->getName() . '/' . $extra['bolt-assets'];
        $dest = $rootExtra['bolt-web-path'] . '/extensions/vendor/' . $package->getName();

        self::mirror($src, $dest, $event);
    }
public static function handle ( PackageEvent $ event ) { $ operation = $ event -> getOperation ( ) ; if ( $ operation instanceof InstallOperation ) { $ package = $ operation -> getPackage ( ) ; } elseif ( $ operation instanceof UpdateOperation ) { $ package = $ operation -> getTargetPackage ( ) ; } else { return ; } $ extra = $ package -> getExtra ( ) ; if ( $ package -> getType ( ) !== 'bolt-extension' || ! isset ( $ extra [ 'bolt-assets' ] ) ) { return ; } $ rootExtra = $ event -> getComposer ( ) -> getPackage ( ) -> getExtra ( ) ; if ( realpath ( $ rootExtra [ 'bolt-web-path' ] ) === realpath ( $ rootExtra [ 'bolt-root-path' ] ) ) { return ; } // Copy package assets to main web path $ src = 'vendor/' . $ package -> getName ( ) . '/' . $ extra [ 'bolt-assets' ] ; $ dest = $ rootExtra [ 'bolt-web-path' ] . '/extensions/vendor/' . $ package -> getName ( ) ; self :: mirror ( $ src , $ dest , $ event ) ; }
Event handler for composer package events.

@param PackageEvent $event
Event handler for composer package events .