PHP 8 Installation on Mac M1 via homebrew

Install first homebrew, if it is not already installed. Paste that in macOS Terminal.

/bin/bash -c "$(curl -fsSL"

And follow the ==> Next steps: after Installation add homebrew to your PATH

Actually Default Image for php from Brew Package Repository is a PHP 8. Here we can see that:

Thats means, we can simple install the php 8 in a macOS Terminal with this command brew install php, but we want to explicit install version 8, other versions can be declared as standard in the future. Paste that in terminal

brew install php@8.0

after that, you should be linked the installed php as system default php interpreter, for that run this command in terminal

brew link php

after restarting terminal, you must be see this output

d8devs@MBP-von-d8dev ~ % php -v
PHP 8.0.8 (cli) (built: Jul 12 2021 02:58:53) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies

Enjoy 😉