src/Installer.php
protected function installDotEnv(PackageInterface $package)
    {
        $templatePath = $this->getTempPath($package) . '/.env.template';
        $dotEnvPath = $this->getInstallPath($package) . '/.env';
        $dotEnvExamplePath = $this->getInstallPath($package) . '/.env.example';
        
        if (! file_exists($templatePath)) {
            return;
        }
        
        $saltKeys = [
            'AUTH_KEY',
            'SECURE_AUTH_KEY',
            'LOGGED_IN_KEY',
            'NONCE_KEY',
            'AUTH_SALT',
            'SECURE_AUTH_SALT',
            'LOGGED_IN_SALT',
            'NONCE_SALT',
        ];
        
        $envExample = ['APP_PUBLIC' => 'public'];
        
        foreach ($saltKeys as $salt) {
            $envExample[$salt] = 'YOUR_' . $salt . '_GOES_HERE';
        }
        
        $this->compileTemplate($templatePath, $dotEnvExamplePath, $envExample);
        
        if (file_exists($dotEnvPath)) {
            return;
        }
        
        $env = ['APP_PUBLIC' => $this->plugin->getPublicDirectory()];
        
        foreach ($saltKeys as $salt) {
            $env[$salt] = $this->generateSalt();
        }
        
        $this->compileTemplate($templatePath, $dotEnvPath, $env);
    }
protected function installDotEnv(PackageInterface $package)
    {
        $templatePath = $this->getTempPath($package) . '/.env.template';
        $dotEnvPath = $this->getInstallPath($package) . '/.env';
        $dotEnvExamplePath = $this->getInstallPath($package) . '/.env.example';
        
        if (! file_exists($templatePath)) {
            return;
        }
        
        $saltKeys = [
            'AUTH_KEY',
            'SECURE_AUTH_KEY',
            'LOGGED_IN_KEY',
            'NONCE_KEY',
            'AUTH_SALT',
            'SECURE_AUTH_SALT',
            'LOGGED_IN_SALT',
            'NONCE_SALT',
        ];
        
        $envExample = ['APP_PUBLIC' => 'public'];
        
        foreach ($saltKeys as $salt) {
            $envExample[$salt] = 'YOUR_' . $salt . '_GOES_HERE';
        }
        
        $this->compileTemplate($templatePath, $dotEnvExamplePath, $envExample);
        
        if (file_exists($dotEnvPath)) {
            return;
        }
        
        $env = ['APP_PUBLIC' => $this->plugin->getPublicDirectory()];
        
        foreach ($saltKeys as $salt) {
            $env[$salt] = $this->generateSalt();
        }
        
        $this->compileTemplate($templatePath, $dotEnvPath, $env);
    }
protected function installDotEnv ( PackageInterface $ package ) { $ templatePath = $ this -> getTempPath ( $ package ) . '/.env.template' ; $ dotEnvPath = $ this -> getInstallPath ( $ package ) . '/.env' ; $ dotEnvExamplePath = $ this -> getInstallPath ( $ package ) . '/.env.example' ; if ( ! file_exists ( $ templatePath ) ) { return ; } $ saltKeys = [ 'AUTH_KEY' , 'SECURE_AUTH_KEY' , 'LOGGED_IN_KEY' , 'NONCE_KEY' , 'AUTH_SALT' , 'SECURE_AUTH_SALT' , 'LOGGED_IN_SALT' , 'NONCE_SALT' , ] ; $ envExample = [ 'APP_PUBLIC' => 'public' ] ; foreach ( $ saltKeys as $ salt ) { $ envExample [ $ salt ] = 'YOUR_' . $ salt . '_GOES_HERE' ; } $ this -> compileTemplate ( $ templatePath , $ dotEnvExamplePath , $ envExample ) ; if ( file_exists ( $ dotEnvPath ) ) { return ; } $ env = [ 'APP_PUBLIC' => $ this -> plugin -> getPublicDirectory ( ) ] ; foreach ( $ saltKeys as $ salt ) { $ env [ $ salt ] = $ this -> generateSalt ( ) ; } $ this -> compileTemplate ( $ templatePath , $ dotEnvPath , $ env ) ; }
Set up the .env file.

@param  \Composer\Package\PackageInterface  $package
@return void
Set up the . env file .