- Start by downloading Composer from https://getcomposer.org/
> Use the following command to install Composer using Homebrew: brew install composer
> Download the Composer installer using the following command: php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
> Verify the integrity of the installer by comparing its hash using the following command: php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
> Run the Composer installer with the following command: php composer-setup.php
> Clean up by removing the installer file with the following command: php -r "unlink('composer-setup.php');"
> Move the Composer executable to /usr/local/bin/ using the following command: mv composer.phar /usr/local/bin/composer
> Use Homebrew to install PHP with the following command: brew install php
> Install PHP 8.0 using Homebrew: brew install php80
> Install MySQL using Homebrew: brew install mysql
> If PHP 8.2 is already linked, unlink it with the following command: brew unlink php@8.2
> Link PHP 8.2 using the following command: brew link php@8.2
> If PHP 8.0 is already linked, unlink it with the following command: brew unlink php@8.0
> Link PHP 8.0 using the following command: brew link php@8.0
> Fetch the Laravel example application using the following command: curl -s "https://laravel.build/example-app" | bash
> Navigate into the example application directory with the following command: cd example-app
> Start the Laravel Sail environment with the following command: ./vendor/bin/sail up
> Clone the xxx-laravel repository from GitHub using the following command: git clone git@github.com:xxx-xxx/xxx-laravel.git
> Navigate into the xxx-laravel directory with the following command: cd xxx-laravel
> Install Composer dependencies with the following command: composer install
> Serve the application using the following command: php artisan serve
Here’s a glimpse of the setup process using Homebrew and Composer for installing dependencies and setting up a Laravel project.