SteamDiesel's avatar

Laravel on snapdragon X Elite (2024)

Hey Laravel team.

I wanted to share that it is indeed possible to get your dev environment set up and working on the new Snapdragon, with a few concessions.

First; forget using Sail. As of writing, the PHP container does not list compatibility with the laravel.test image, so running ./vendor/bin/sail up in WSL2 ubuntu will give you this outcome:

[+] Running 2/6
 ⠸ redis Pulling                                                                                            10.3s
 ⠸ mailpit Pulling                                                                                          10.3s
 ! laravel.test Warning context canceled                                                                    10.3s
 ✔ mysql Pulled                                                                                              3.5s
 ⠸ meilisearch Pulling                                                                                      10.3s
 ⠸ selenium Pulling                                                                                         10.3s
no matching manifest for linux/arm64/v8 in the manifest list entries

How to set up Laravel Dev environment on Windows 11 with Snapdragon Arm64

Install Laravel Herd

You should only need the free version of Herd, however, if you install the paid version it may eliminate the need for the second half of this guide using docker for MySQL. If you are on the free version, then you will need a separate database service if you are running MySQL. This guide assumes you're using MySQL without paying for Herd.

Follow the Laravel Herd installation instructions and documentation, you should be able to get 500 errors because of a missing database, this is good progress.

Install WSL2 with Ubuntu on your machine

In a terminal run wsl --install and follow the prompts to complete the process. You will not need to use this WSL2 Ubuntu environment from here, but docker relies on it to function. So ensure all commands from here are back in your regular Windows terminal in the Windows environment.

Install Docker

To get a reliable database connection running MySQL, you will need to use docker, but it's kind of tricky because, as of writing, they haven't yet listed the installation executable for docker on Windows 11 Arm64 on the website. So to get the right docker build you will need to run this command to get it from the specific download location for Arm64.

In your terminal:

Invoke-WebRequest -Uri "https://desktop.docker.com/win/main/arm64/153621/Docker%20Desktop%20Installer.exe" -OutFile "DockerDesktopInstaller.exe"

you will then need to trigger the installation with this:

Start-Process "DockerDesktopInstaller.exe"

Install a MySQL docker container image

Now that you have docker installed, you only need to install a MySQL service. Here, I have a command ready for you:

docker run --name mysql-container -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password123 -d mysql

After you run this it will take a few minutes to download and start the container, which should be visible in your docker desktop view as a running container that you can start and stop from there. (or run docker ps to see all containers running on the cmd line.

Now this MySQL container can be connected with any DB app like Adminer or TablePlus:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=root
DB_PASSWORD=password123

The database for your application has not yet been made, but you can make the database by connecting to this instance and creating a new database. Then put the database name in your .env and your application should work on the URL provided by Herd.

VS Code on SnapDragon Arm64 chips

I noticed that VS Code would occasionally guzzle CPU resources, cranking up to 40% utilisation and causing the fans to spin up, because I had way too many extensions. I cut a bunch of extensions I don't need and only run these essentials now:

  • PHP Intelephense
  • SynthWave '84 (theme by Rob Owen)
  • Tailwind CSS IntelliSense
  • Vue - Official
  • Code Spell Checker

The CPU utilisation is now consistently under 5% when using these extensions. I also turned on GitHub Co-Pilot to see if it made a difference, it appeared to bump up CPU by 1-3% topping out at 8% while navigating or auto-completing some prompted lines, not a big deal.

0 likes
0 replies

Please or to participate in this conversation.