Start by making sure brew is up-to-date: brew update You can either use the built-in php recipe, but I recommend to use the shivammathur/homebrew-php tap. #normal-upgrade Normal upgrade brew upgrade php #upgrade-with-shivammathur/homebrew-php Upgrade with shivammathur/homebrew-php brew tap shivammathur/php brew install shivammathur/php/php@8.2
PHP extensions are installed using pecl.
Make sure to restart your web server after installing new packages: sudo nginx -s reload sudo apachectl restart valet restart