Merge pull request #588 from MIchaelMainer/patch-1

Update Install-PHP.ps1 to include Composer
This commit is contained in:
Alejandro Pauly
2020-03-23 16:42:11 -04:00
committed by GitHub
2 changed files with 31 additions and 2 deletions

View File

@@ -10,8 +10,11 @@ Import-Module -Name ImageHelpers
$installDir = "c:\tools\php"
choco install php -y --force --params "/InstallDir:$installDir"
# update path to extensions and enable curl and mbstring extensions
((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"') | Set-Content -Path $installDir\php.ini
# Install latest Composer in chocolatey
choco install composer --ia "/DEV=$installDir /PHP=$installDir"
# update path to extensions and enable curl and mbstring extensions, and enable php openssl extensions.
((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"' -replace 'extension=";php_openssl.dll"','extension_dir = "php_openssl.dll"') | Set-Content -Path $installDir\php.ini
# Set the PHPROOT environment variable.
setx PHPROOT $installDir /M

View File

@@ -33,6 +33,32 @@ else
exit 1
}
# Verify that composer.exe is on the path
if(Get-Command -Name 'composer')
{
Write-Host "$(composer --version) is on the path."
}
else
{
Write-Host "composer is not on the path."
exit 1
}
# Get the composer version.
$composerVersion = $(composer --version)
# Add composer version details in Markdown
$SoftwareName = "Composer"
$Description = @"
#### $composerVersion
_Environment:_
* PATH: contains the location of composer.exe version $composerVersion
* PHPROOT: root directory of the Composer $composerVersion installation
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
# Get available versions of PHP
$phpVersionOnPath = Get-PHPVersion -phpRootPath "C:\tools\php72"