Categories
Technical

Install MacOs softwares From Scratch for PHP developer

Install Composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

Make Composer Global

mv composer.phar /usr/local/bin/composer

Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Valet

To get started, you first need to ensure that Homebrew is up to date using the update command:

brew update

Next, you should use Homebrew to install PHP:

brew install php

After installing PHP, you are ready to install the Composer package manager. In addition, you should make sure the ~/.composer/vendor/bin directory is in your system’s “PATH”.

export PATH="$PATH:$HOME/.composer/vendor/bin"

After Composer has been installed, you may install Laravel Valet as a global Composer package:

composer global require laravel/valet

Finally, you may execute Valet’s install command. This will configure and install Valet and DnsMasq. In addition, the daemons Valet depends on will be configured to launch when your system starts:

valet install

Once Valet is installed, try pinging any *.test domain on your terminal using a command such as ping foobar.test. If Valet is installed correctly you should see this domain responding on 127.0.0.1.

Valet will automatically start its required services each time your machine boots.

PHP Versions

Valet allows you to switch PHP versions using the valet use php@version command. Valet will install the specified PHP version via Homebrew if it is not already installed:

valet use [email protected]

valet use php

Leave a Reply