PHP code example of eckinox / installer-plugin

1. Go to this page and download the library: Download eckinox/installer-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eckinox / installer-plugin example snippets




namespace Eckinox\Composer\Tests\MockPackage;

use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
use Composer\Util\Filesystem;
use Eckinox\Composer\HandlerInterface;

class ReplicationHandler implements HandlerInterface
{
    public function __construct(
        private PackageInterface $package, 
        private Filesystem $filesystem, 
        private IOInterface $io)
    {
    }

    public function handleExistingFile(string $packageFilename, string $projectFilename, ?string $currentlyInstalledFilename = null)
    {
    }

    public function postFileCreationCallback(string $projectFilename)
    {
        if (basename($projectFilename) == "rename-me.txt") {
            $newFilename = substr($projectFilename, 0, strlen($projectFilename) - 13) . "renamed.txt";
            rename($projectFilename, $newFilename);
        }
    }
}