If you don't have PHP and Composer installed on your local machine, the following commands will install PHP, Composer, and the Laravel installer on macOS, Windows, or Linux:
macOS:
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.4)"
Windows PowerShell (Run as Administration):
# Run as administrator...
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.4'))
Linux:
/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)"
After running one of the commands above, you should restart your terminal session. To update PHP, Composer, and the Laravel installer after installing them via php.new, you can re-run the command in your terminal.
If you already have PHP and Composer installed, you may install the Laravel installer via Composer:
composer global require laravel/installer
Creating an Application
laravel new example-app
Once the application has been created, you can start Laravel's local development server, queue worker, and Vite development server using the dev Composer script:
cd example-app
npm install && npm run build
composer run dev
If after run Show this Error: Failed to listen on 127.0.0.1:8000 (reason: ?)
Then Run This Command:
php -S localhost:8000 -t public
Once you have started the development server, your application will be accessible in your web browser at http://localhost:8000. Next, you're ready to start taking your next steps into the Laravel ecosystem.