Setup a new project using Laravel Sail (macOS)
[00:33] Open a new terminal and before you get started make sure you have docker up and running by typing in docker -v
and press enter. This will show your current docker version. if you see something like this you're good to go.
[00:50] Now cd into where you usually keep your projects. In my case I have a projects directory right in my home path, then run the following command: curl -s https://laravel.build/example | bash
- and here you'll have to type the name of your application. In my case I will set this to tallpad, add in the closing quotes, bang, and press enter.
[00:47] What this will do is it will download some instructions, execute them, and set up Laravel inside a directory named after your application. It may ask you for your operating system password, so type it in and press enter.
[01:02] Navigate to the application directory and start Laravel Sail using the following command: ./vendor/bin/sail up
. When you run this command for the first time it will take a few minutes to complete, so be patient; subsequent calls will run much much faster.
[01:28] You may receive, like me, this mysql "ports are not available" error. The easiest way to fix it is to stop your current mysql service. To do that type in brew services stop mysql
and press enter. Then rerun the sail command. So I'll go up, and here it is: ./vendor/bin/sail up
enter.
[01:57] And now we receive another error saying that it "cannot start service laravel.test ports are not available". This is most likely because you have valet installed so let's also stop valet. valet stop
and rerun the sail command.
[02:21] Now we can access our application by going to localhost, and here it is. This is our fresh Laravel installation using Laravel Sail.
-
Setup a new project using Laravel Sail (macOS)02:33
-
2Executing commands inside your application containers02:20
-
3Creating a database client connection01:30
-
4Testing emails with Mailhog02:35
-
5Changing the php version in Laravel Sail01:29
-
6Run Sail and Valet in parallel01:39
-
7Customizing Laravel Sail01:25
-
8Setup Laravel Sail for an existing Laravel application00:49
-
Setup a new project using Laravel Sail (macOS)02:33
-
2Executing commands inside your application containers02:20
-
3Creating a database client connection01:30
-
4Testing emails with Mailhog02:35
-
5Changing the php version in Laravel Sail01:29
-
6Run Sail and Valet in parallel01:39
-
7Customizing Laravel Sail01:25
-
8Setup Laravel Sail for an existing Laravel application00:49