Improve code and examples

This commit is contained in:
Shivam Mathur
2019-10-08 18:12:54 +05:30
parent 7e81c058fb
commit 46a875ad7e
31 changed files with 1049 additions and 589 deletions

View File

@ -6,26 +6,26 @@ if($version -eq '7.4') {
$version = '7.4RC'
}
echo "Installing PhpManager"
Write-Host "Installing PhpManager" -ForegroundColor Blue
Install-Module -Name PhpManager -Force -Scope CurrentUser
$installed = $($(php -v)[0] -join '')[4..6] -join ''
if($installed -ne $version) {
if($version -lt '7.0') {
echo "Installing VcRedist"
Write-Host "Installing VcRedist"
Install-Module -Name VcRedist -Force
}
echo "Installing PHP"
Write-Host "Installing PHP" -ForegroundColor Blue
Uninstall-Php C:\tools\php
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -InstallVC -Path C:\tools\php$version -TimeZone UTC -InitialPhpIni Production -Force
echo "Switch PHP"
Write-Host "Switch PHP" -ForegroundColor Blue
(Get-PhpSwitcher).targets
Initialize-PhpSwitcher -Alias C:\tools\php -Scope CurrentUser -Force
Add-PhpToSwitcher -Name $version -Path C:\tools\php$version -Force
Switch-Php $version -Force
}
echo "Housekeeping in PHP.ini, enabling openssl"
Write-Host "Housekeeping in PHP.ini, enabling openssl" -ForegroundColor Blue
$ext_dir = "C:\tools\php\ext"
Add-Content C:\tools\php\php.ini "date.timezone = 'UTC'"
Set-PhpIniKey extension_dir $ext_dir
@ -37,7 +37,7 @@ if($version -lt '7.4') {
Copy-Item "php_pcov.dll" -Destination $ext_dir"\php_pcov.dll"
}
echo "Installing Composer"
Write-Host "Installing Composer" -ForegroundColor Blue
Install-Composer -Scope System -Path C:\tools\php
php -v
composer -V